On 22 March 2018 04:08, Guenter Roeck wrote: > > +static ssize_t power_supply_show_usb_type(struct device *dev, > > + enum power_supply_usb_type > *usb_types, > > + ssize_t num_usb_types, > > + union power_supply_propval *value, > > + char *buf) > > +{ > > + enum power_supply_usb_type usb_type; > > + ssize_t count = 0; > > + bool match = false; > > + int i; > > + > > + if ((!usb_types) || (num_usb_types <= 0)) { > > Unnecessary ( ) Fine, can remove. > > > + dev_warn(dev, "driver has no valid connected types\n"); > > Are those warnings useful or do they just clog the log ? Either case, if that happens, > wouldn't it be better to detect the situation during registration and abort ? This is added as an optional property for supply drivers. This will only show up if a supply driver adds the USB_TYPE property to its list, and then someone attempts to access it. Actually there's no current checking for the psy_desc information provided to the register function, so for example if it's NULL then the kernel will dump when it tries to dereference. I'll take a look at this and see if I can add something, including checks on the usb_type property. ��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥