[bug report] usb: phy: Add USB charger support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Baolin Wang,

This is a semi-automatic email about new static checker warnings.

The patch a9081a008f84: "usb: phy: Add USB charger support" from Aug 
15, 2017, leads to the following Smatch complaint:

include/linux/usb/phy.h:327 usb_phy_set_power()
	 warn: variable dereferenced before check 'x' (see line 325)

include/linux/usb/phy.h
   322  static inline int
   323  usb_phy_set_power(struct usb_phy *x, unsigned mA)
   324	{
   325		usb_phy_set_charger_current(x, mA);
                                            ^
The patch adds an unchecked dereference.

   326	
   327		if (x && x->set_power)
                    ^
The existing code checks for NULL.  But so far as I know non of the
existing caller pass a NULL usb_phy and it doesn't really make sense
to me to do that.  Perhaps just remove the NULL check?

   328			return x->set_power(x, mA);
   329		return 0;

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux