* [PATCH] thermal: Fix test of unsigned in thermal_cooling_device_cur_state_store()
@ 2009-12-15 21:46 Roel Kluin
2009-12-16 1:05 ` Zhang Rui
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-12-15 21:46 UTC (permalink / raw)
To: Andrew Morton, LKML, Len Brown, Greg Kroah-Hartman, Zhang Rui,
Matthew Garrett
state is unsigned long so the test did not work.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Found using coccinelle: http://coccinelle.lip6.fr/
Is this the best way to fix this?
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 6f8d8f9..800e0c5 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -374,7 +374,7 @@ thermal_cooling_device_cur_state_store(struct device *dev,
if (!sscanf(buf, "%ld\n", &state))
return -EINVAL;
- if (state < 0)
+ if ((long)state < 0)
return -EINVAL;
result = cdev->ops->set_cur_state(cdev, state);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] thermal: Fix test of unsigned in thermal_cooling_device_cur_state_store()
2009-12-15 21:46 [PATCH] thermal: Fix test of unsigned in thermal_cooling_device_cur_state_store() Roel Kluin
@ 2009-12-16 1:05 ` Zhang Rui
0 siblings, 0 replies; 2+ messages in thread
From: Zhang Rui @ 2009-12-16 1:05 UTC (permalink / raw)
To: Roel Kluin
Cc: Andrew Morton, LKML, Brown, Len, Greg Kroah-Hartman,
Matthew Garrett
On Wed, 2009-12-16 at 05:46 +0800, Roel Kluin wrote:
> state is unsigned long so the test did not work.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
> ---
> Found using coccinelle: http://coccinelle.lip6.fr/
>
> Is this the best way to fix this?
>
> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
> index 6f8d8f9..800e0c5 100644
> --- a/drivers/thermal/thermal_sys.c
> +++ b/drivers/thermal/thermal_sys.c
> @@ -374,7 +374,7 @@ thermal_cooling_device_cur_state_store(struct device *dev,
> if (!sscanf(buf, "%ld\n", &state))
> return -EINVAL;
>
> - if (state < 0)
> + if ((long)state < 0)
> return -EINVAL;
>
> result = cdev->ops->set_cur_state(cdev, state);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-16 1:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 21:46 [PATCH] thermal: Fix test of unsigned in thermal_cooling_device_cur_state_store() Roel Kluin
2009-12-16 1:05 ` Zhang Rui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox