[patch 3/3] pc87360 - fix unchecked rc=device_create_file() - do the checks

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

 



Hi Jim,

> > 3- rework sys-device-interface startup
> >     use sysfs_create_group() for 2 sensor-types which are chip-model invariant.
> >        ie all-or-nothing attribute groups
> >     other 2 groups vary too much due to configuration, etc,
> >        so we keep the loops of device_create_file(), but now check their returns.
> > 
> > Signed-off-by:   Jim Cromie  <jim.cromie at gmail.com>

I just noticed that you do not properly propagate the error value if a
device file creation actually fails:

> > diff -ruNp -X dontdiff -X exclude-diffs ab-2/drivers/hwmon/pc87360.c ab-3/drivers/hwmon/pc87360.c
> > --- ab-2/drivers/hwmon/pc87360.c	2006-08-18 17:40:35.000000000 -0600
> > +++ ab-3/drivers/hwmon/pc87360.c	2006-08-18 18:54:24.000000000 -0600

> > +	/* Register all-or-nothing sysfs groups */
> > +
> > +	if (data->innr && 
> > +	    sysfs_create_group(&client->dev.kobj,
> > +			       &pc8736x_vin_group))
> >  		goto ERROR3;

> >  	if (data->tempnr) {
> >  		for (i = 0; i < data->tempnr; i++) {
> > +			if (device_create_file(dev, &temp_input[i].dev_attr)
> > +			    || device_create_file(dev, &temp_min[i].dev_attr)
> > +			    || device_create_file(dev, &temp_max[i].dev_attr)
> > +			    || device_create_file(dev, &temp_crit[i].dev_attr)
> > +			    || device_create_file(dev, &temp_status[i].dev_attr))
> > +				goto ERROR3;

I've fixed that, modified patch is attached, I hope you like it.

-- 
Jean Delvare
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hwmon-unchecked-return-status-fixes-pc87360-3.patch
Url: http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20060923/de6416cf/attachment.pl 


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux