]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: phy: return -ENODEV on failure of try_module_get
authorArjun Sreedharan <arjun024@gmail.com>
Mon, 18 Aug 2014 05:47:33 +0000 (11:17 +0530)
committerFelipe Balbi <balbi@ti.com>
Tue, 19 Aug 2014 14:21:28 +0000 (09:21 -0500)
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>
drivers/usb/phy/phy.c

index 6d0f6080eceb309201abb2afae10080c6b67ba84..045cd309367ae7e9df8bbb9726ddb4b99de23ea1 100644 (file)
@@ -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;
        }