lkml.org 
[lkml]   [2018]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v5 3/5] power: supply: Add 'usb_type' property and supporting code
Date
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.
\
 
 \ /
  Last update: 2018-03-22 11:29    [W:0.046 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site