Commit 53784254 authored by Arjun Sreedharan's avatar Arjun Sreedharan Committed by Jiri Slaby

usb: phy: return -ENODEV on failure of try_module_get

commit 2c4e3dbf upstream.

When __usb_find_phy_dev() does not return error and
try_module_get() fails, return -ENODEV.
Signed-off-by: default avatarArjun Sreedharan <arjun024@gmail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 297b3ddd
......@@ -229,6 +229,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)) {
pr_err("unable to find transceiver\n");
if (!IS_ERR(phy))
phy = ERR_PTR(-ENODEV);
goto err0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment