lkml.org 
[lkml]   [2006]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling
> --- linux-work-clean/drivers/hwmon/w83627hf.c	2006-08-20 22:02:40.000000000 +0200
> +++ linux-work/drivers/hwmon/w83627hf.c 2006-08-20 22:27:14.000000000 +0200
> @@ -513,9 +513,21 @@ static DEVICE_ATTR(in0_max, S_IRUGO | S_
>
> #define device_create_file_in(client, offset) \
> do { \
> -device_create_file(&client->dev, &dev_attr_in##offset##_input); \
> -device_create_file(&client->dev, &dev_attr_in##offset##_min); \
> -device_create_file(&client->dev, &dev_attr_in##offset##_max); \
> + err = device_create_file(&client->dev, &dev_attr_in##offset##_input); \
> + if (err) {\
> + hwmon_device_unregister(data->class_dev); \
> + return err; \
> + } \
> + err = device_create_file(&client->dev, &dev_attr_in##offset##_min); \
> + if (err) {\
> + hwmon_device_unregister(data->class_dev); \
> + return err; \
> + } \
> + err = device_create_file(&client->dev, &dev_attr_in##offset##_max); \
> + if (err) {\
> + hwmon_device_unregister(data->class_dev); \
> + return err; \
> + } \
> } while (0)

_Never_ use "return" in a macro. It's way too confusing for whoever will
read the code later.

--
Jean Delvare
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-08-21 10:07    [W:0.254 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site