usb: phy: propagate __of_usb_find_phy()'s error on failure

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.

[ [email protected] : remove trailing whitespace ]

Signed-off-by: Arjun Sreedharan <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
This commit is contained in:
Arjun Sreedharan authored and Felipe Balbi committed 2014-11-20 13:43:22 -06:00
1 parent 62c606978a
commit 1290a958d4
1 file changed
+3 -1
+3 -1
View 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;
}