OSDN Git Service
(root)
/
uclinux-h8
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
06e7493
)
usb: phy: Avoid unchecked dereference warning
author
Baolin Wang
<baolin.wang@linaro.org>
Mon, 28 Aug 2017 11:02:41 +0000
(19:02 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 31 Aug 2017 16:08:47 +0000
(18:08 +0200)
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>
include/linux/usb/phy.h
patch
|
blob
|
history
diff --git
a/include/linux/usb/phy.h
b/include/linux/usb/phy.h
index
de881b1
..
8c69148
100644
(file)
--- a/
include/linux/usb/phy.h
+++ b/
include/linux/usb/phy.h
@@
-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;
}