usb: phy: propagate __of_usb_find_phy()'s error on failure
authorArjun Sreedharan <arjun024@gmail.com>
Thu, 20 Nov 2014 15:53:36 +0000 (21:23 +0530)
committerFelipe Balbi <balbi@ti.com>
Thu, 20 Nov 2014 19:43:22 +0000 (13:43 -0600)
When __of_usb_find_phy() fails, it returns -ENODEV - its
error code has to be returned by devm_usb_get_phy_by_phandle().
Only when the former function succeeds and try_module_get()
fails should -EPROBE_DEFER be returned.

[ balbi@ti.com : remove trailing whitespace ]

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/phy/phy.c

index 045cd309367ae7e9df8bbb9726ddb4b99de23ea1..e6bf801a339a477c7d0abc0841ffd170d95ae60a 100644 (file)
@@ -191,7 +191,9 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
 
        phy = __of_usb_find_phy(node);
        if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
-               phy = ERR_PTR(-EPROBE_DEFER);
+               if (!IS_ERR(phy))
+                       phy = ERR_PTR(-EPROBE_DEFER);
+
                devres_free(ptr);
                goto err1;
        }