[lm-sensors] [PATCH] w83792d - fix unchecked return codes from device_create_file / remove the files on cleanup

Jean Delvare khali at linux-fr.org
Sat Sep 23 12:45:01 CEST 2006


Hi Rudolf,

> Following patch fixes the w83792d driver. It adds error checking to 
> device_create file and also cares to destroy the files upon exit.
> 
> I will test it as soon I will get the disk back to my test machine with this 
> chip. Possible dates are: Saturday evening, Sunday and Monday for sure ;)
> Until now, compiles without warnings.

Applied, with the following fix:

> @@ -1342,12 +1428,16 @@ static int
>  w83792d_detach_client(struct i2c_client *client)
>  {
>  	struct w83792d_data *data = i2c_get_clientdata(client);
> -	int err;
> +	int err, i;
>  
>  	/* main client */
>  	if (data)
>  		hwmon_device_unregister(data->class_dev);
>  
> +	sysfs_remove_group(&client->dev.kobj, &w83792d_group);
> +	for (i = 0; i < ARRAY_SIZE(w83792d_group_fan); i++)
> +		sysfs_remove_group(&client->dev.kobj, &w83792d_group_fan[i]);
> +
>  	if ((err = i2c_detach_client(client)))
>  		return err;
>  
> 

Only the main client has the files, so the file removal should be
conditional upon "data" too.

The rest looks OK to me. Testing is still welcome nevertheless.

Thanks,
-- 
Jean Delvare




More information about the lm-sensors mailing list