提交 9dc9cb0c 编写于 作者: M Mathias Krause 提交者: Felipe Balbi

usb: phy: return an error in usb_get_phy() if try_module_get() fails

In case we found a matching USB PHY in usb_get_phy() but the call to
try_module_get() fails, we shouldn't return a (probably soon dangling)
pointer but an ERR_PTR instead.
Signed-off-by: NMathias Krause <minipli@googlemail.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 ae8dd0cc
...@@ -132,6 +132,9 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type) ...@@ -132,6 +132,9 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type)
if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
pr_debug("PHY: unable to find transceiver of type %s\n", pr_debug("PHY: unable to find transceiver of type %s\n",
usb_phy_type_string(type)); usb_phy_type_string(type));
if (!IS_ERR(phy))
phy = ERR_PTR(-ENODEV);
goto err0; goto err0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册