提交 eb3c74de 编写于 作者: B Baolin Wang 提交者: Greg Kroah-Hartman

usb: phy: Avoid unchecked dereference warning

Move the USB phy NULL checking before issuing usb_phy_set_charger_current()
to avoid unchecked dereference warning.
Signed-off-by: NBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 06e74935
......@@ -322,9 +322,12 @@ static inline void usb_phy_set_charger_state(struct usb_phy *usb_phy,
static inline int
usb_phy_set_power(struct usb_phy *x, unsigned mA)
{
if (!x)
return 0;
usb_phy_set_charger_current(x, mA);
if (x && x->set_power)
if (x->set_power)
return x->set_power(x, mA);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册