summaryrefslogtreecommitdiff
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorArjun Sreedharan <arjun024@gmail.com>2014-11-20 15:53:36 (GMT)
committerFelipe Balbi <balbi@ti.com>2014-11-20 19:43:22 (GMT)
commit1290a958d48e30d60262a33acb5f068e87834ce4 (patch)
tree19b4ca45f7f83363fbb6761dd861adc950a94ec2 /drivers/usb/phy
parent62c606978aa028260f88d0dcb9834bbb7a42b048 (diff)
downloadlinux-1290a958d48e30d60262a33acb5f068e87834ce4.tar.xz
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. [ balbi@ti.com : remove trailing whitespace ] Signed-off-by: Arjun Sreedharan <arjun024@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 045cd30..e6bf801 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -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;
}