* [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits
@ 2012-01-20 15:09 Jean Delvare
2012-01-20 15:22 ` Guenter Roeck
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jean Delvare @ 2012-01-20 15:09 UTC (permalink / raw)
To: lm-sensors
Properly clamp temperature limits set by the user. Without this fix,
attempts to write temperature limits above the maximum supported by
the chip (255 degrees Celsius) would arbitrarily and unexpectedly
result in the limit being set to 0 degree Celsius.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org
---
drivers/hwmon/f71805f.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- linux-3.3-rc1.orig/drivers/hwmon/f71805f.c 2012-01-20 14:37:27.449912137 +0100
+++ linux-3.3-rc1/drivers/hwmon/f71805f.c 2012-01-20 14:58:33.600930905 +0100
@@ -283,10 +283,10 @@ static inline long temp_from_reg(u8 reg)
static inline u8 temp_to_reg(long val)
{
- if (val < 0)
- val = 0;
- else if (val > 1000 * 0xff)
- val = 0xff;
+ if (val <= 0)
+ return 0;
+ if (val >= 1000 * 0xff)
+ return 0xff;
return (val + 500) / 1000;
}
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits
2012-01-20 15:09 [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits Jean Delvare
@ 2012-01-20 15:22 ` Guenter Roeck
2012-01-20 16:41 ` Jean Delvare
2012-01-20 17:06 ` Guenter Roeck
2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2012-01-20 15:22 UTC (permalink / raw)
To: lm-sensors
On Fri, Jan 20, 2012 at 10:09:23AM -0500, Jean Delvare wrote:
> Properly clamp temperature limits set by the user. Without this fix,
> attempts to write temperature limits above the maximum supported by
> the chip (255 degrees Celsius) would arbitrarily and unexpectedly
> result in the limit being set to 0 degree Celsius.
>
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
> Cc: stable@vger.kernel.org
Good catch. Applied.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits
2012-01-20 15:09 [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits Jean Delvare
2012-01-20 15:22 ` Guenter Roeck
@ 2012-01-20 16:41 ` Jean Delvare
2012-01-20 17:06 ` Guenter Roeck
2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2012-01-20 16:41 UTC (permalink / raw)
To: lm-sensors
On Fri, 20 Jan 2012 07:22:29 -0800, Guenter Roeck wrote:
> On Fri, Jan 20, 2012 at 10:09:23AM -0500, Jean Delvare wrote:
> > Properly clamp temperature limits set by the user. Without this fix,
> > attempts to write temperature limits above the maximum supported by
> > the chip (255 degrees Celsius) would arbitrarily and unexpectedly
> > result in the limit being set to 0 degree Celsius.
> >
> > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > Cc: stable@vger.kernel.org
>
> Good catch. Applied.
Note that this patch conflicts with one of yours. For smooth
integration in stable trees it would be best to apply mine first and
yours on top. If you can't be bothered, you can also drop all f71805f
patches and I'll handle them, just let me know.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits
2012-01-20 15:09 [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits Jean Delvare
2012-01-20 15:22 ` Guenter Roeck
2012-01-20 16:41 ` Jean Delvare
@ 2012-01-20 17:06 ` Guenter Roeck
2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2012-01-20 17:06 UTC (permalink / raw)
To: lm-sensors
On Fri, Jan 20, 2012 at 11:41:57AM -0500, Jean Delvare wrote:
> On Fri, 20 Jan 2012 07:22:29 -0800, Guenter Roeck wrote:
> > On Fri, Jan 20, 2012 at 10:09:23AM -0500, Jean Delvare wrote:
> > > Properly clamp temperature limits set by the user. Without this fix,
> > > attempts to write temperature limits above the maximum supported by
> > > the chip (255 degrees Celsius) would arbitrarily and unexpectedly
> > > result in the limit being set to 0 degree Celsius.
> > >
> > > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > > Cc: stable@vger.kernel.org
> >
> > Good catch. Applied.
>
> Note that this patch conflicts with one of yours. For smooth
> integration in stable trees it would be best to apply mine first and
> yours on top. If you can't be bothered, you can also drop all f71805f
> patches and I'll handle them, just let me know.
>
No problem; thanks for the note. Fixed it already, by moving your patch
to the head of my patch list.
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-20 17:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 15:09 [lm-sensors] [PATCH] hwmon: (f71805f) Fix clamping of temperature limits Jean Delvare
2012-01-20 15:22 ` Guenter Roeck
2012-01-20 16:41 ` Jean Delvare
2012-01-20 17:06 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.