summaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorArjun Sreedharan <arjun024@gmail.com>2014-08-18 11:17:33 +0530
committerLuis Henriques <luis.henriques@canonical.com>2014-11-03 10:50:19 +0000
commit774c6ae424326716eaea92d4ad58df9bf0e5a5a7 (patch)
treed0d1967dcacb031760a7d840923a0151bf3cfcbf /drivers/usb/phy
parentad0f3236b95c392787cb8555aea5ee1c4d84f01e (diff)
downloadlinux-stable-774c6ae424326716eaea92d4ad58df9bf0e5a5a7.tar.gz
linux-stable-774c6ae424326716eaea92d4ad58df9bf0e5a5a7.tar.bz2
linux-stable-774c6ae424326716eaea92d4ad58df9bf0e5a5a7.zip
usb: phy: return -ENODEV on failure of try_module_get
commit 2c4e3dbf63b39d44a291db70016c718f45d9cd46 upstream. When __usb_find_phy_dev() does not return error and try_module_get() fails, return -ENODEV. Signed-off-by: Arjun Sreedharan <arjun024@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 36b6bce33b20..fd0d7f122ace 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -232,6 +232,9 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
phy = __usb_find_phy_dev(dev, &phy_bind_list, index);
if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
dev_dbg(dev, "unable to find transceiver\n");
+ if (!IS_ERR(phy))
+ phy = ERR_PTR(-ENODEV);
+
goto err0;
}