[lm-sensors] [PATCH] hwmon: (lm95241) Check validity of input values

Davide Rizzo elpa.rizzo at gmail.com
Sun Nov 7 10:11:52 CET 2010


2010/11/5 Jean Delvare <khali at linux-fr.org>

> This clears the following build-time warnings I was seeing:
>
> drivers/hwmon/lm95241.c: In function "set_interval":
> drivers/hwmon/lm95241.c:132:15: warning: ignoring return value of
> "strict_strtol", declared with attribute warn_unused_result
> drivers/hwmon/lm95241.c: In function "set_max2":
> drivers/hwmon/lm95241.c:278:1: warning: ignoring return value of
> "strict_strtol", declared with attribute warn_unused_result
> drivers/hwmon/lm95241.c: In function "set_max1":
> drivers/hwmon/lm95241.c:277:1: warning: ignoring return value of
> "strict_strtol", declared with attribute warn_unused_result
> drivers/hwmon/lm95241.c: In function "set_min2":
> drivers/hwmon/lm95241.c:249:1: warning: ignoring return value of
> "strict_strtol", declared with attribute warn_unused_result
> drivers/hwmon/lm95241.c: In function "set_min1":
> drivers/hwmon/lm95241.c:248:1: warning: ignoring return value of
> "strict_strtol", declared with attribute warn_unused_result
> drivers/hwmon/lm95241.c: In function "set_type2":
> drivers/hwmon/lm95241.c:220:1: warning: ignoring return value of
> "strict_strtol", declared with attribute warn_unused_result
> drivers/hwmon/lm95241.c: In function "set_type1":
> drivers/hwmon/lm95241.c:219:1: warning: ignoring return value of
> "strict_strtol", declared with attribute warn_unused_result
>
> This also fixes a small race in set_interval() as a side effect: by
> working with a temporary local variable we prevent data->interval from
> being accessed at a time it contains the interval value in the wrong
> unit.
>
> Signed-off-by: Jean Delvare <khali at linux-fr.org>
> Cc: Davide Rizzo <elpa.rizzo at gmail.com>
> ---
> The sysfs interface part of this driver would deserve a complete
> rewrite, macro-generated functions are simply too ugly. But I don't
> have the time to do this right now.
>
>
> Jean Delvare
>

I already rewrote drivers/hwmon/lm95241.c without macro-generated functions,
I posted it to the list a long time ago but nobody cared it.
Here it is again (including your corrections).
Signed-off-by: Davide Rizzo <elpa.rizzo at gmail.com>
------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20101107/198472a2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm95241.c
Type: text/x-csrc
Size: 14253 bytes
Desc: not available
URL: <http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20101107/198472a2/attachment.bin>


More information about the lm-sensors mailing list