From: Arjun Sreedharan Date: Mon, 18 Aug 2014 05:47:33 +0000 (+0530) Subject: usb: phy: return -ENODEV on failure of try_module_get X-Git-Tag: v3.17-rc3~11^2~15^2~14 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=2c4e3dbf63b39d44a291db70016c718f45d9cd46;p=~emulex%2Finfiniband.git usb: phy: return -ENODEV on failure of try_module_get When __usb_find_phy_dev() does not return error and try_module_get() fails, return -ENODEV. Signed-off-by: Arjun Sreedharan Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 6d0f6080ece..045cd309367 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; }