mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-15 10:54:05 +00:00
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: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
06e74935c7
commit
eb3c74de28
1 changed files with 4 additions and 1 deletions
|
@ -322,9 +322,12 @@ static inline void usb_phy_set_charger_state(struct usb_phy *usb_phy,
|
||||||
static inline int
|
static inline int
|
||||||
usb_phy_set_power(struct usb_phy *x, unsigned mA)
|
usb_phy_set_power(struct usb_phy *x, unsigned mA)
|
||||||
{
|
{
|
||||||
|
if (!x)
|
||||||
|
return 0;
|
||||||
|
|
||||||
usb_phy_set_charger_current(x, mA);
|
usb_phy_set_charger_current(x, mA);
|
||||||
|
|
||||||
if (x && x->set_power)
|
if (x->set_power)
|
||||||
return x->set_power(x, mA);
|
return x->set_power(x, mA);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue