[lm-sensors] [PATCH] hwmon/lm70: Add a name attribute

Jean Delvare khali at linux-fr.org
Sat Aug 18 16:07:18 CEST 2007


Hi Kaiwan,

On Sat, 18 Aug 2007 11:44:22 +0530, Kaiwan N Billimoria wrote:
> > @@ -115,7 +123,8 @@ static int __devinit lm70_probe(struct s
> >  	}
> >  	dev_set_drvdata(&spi->dev, p_lm70);
> >  
> > -	if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))) {
> > +	if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))
> > +	 || (status = device_create_file(&spi->dev, &dev_attr_name))) {
> >  		dev_dbg(&spi->dev, "device_create_file failure.\n");
> >  		goto out_dev_create_file_failed;
> >  	}
> > @@ -123,6 +132,7 @@ static int __devinit lm70_probe(struct s
> >  	return 0;
> >  
> >  out_dev_create_file_failed:
> > +	device_remove_file(&spi->dev, &dev_attr_temp1_input);
>
> Ah. Thanks!
> 
> >  	hwmon_device_unregister(p_lm70->cdev);
> >  out_dev_reg_failed:
> >  	dev_set_drvdata(&spi->dev, NULL);

Just to make it clear: there was no bug there. This call to
device_remove_file() is now needed in the case where the temp1_input
file would be successfully created but the name file creation would
fail.

-- 
Jean Delvare



More information about the lm-sensors mailing list