lkml.org 
[lkml]   [2009]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] thermal: Fix test of unsigned in thermal_cooling_device_cur_state_store()
From
Date
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);




\
 
 \ /
  Last update: 2009-12-16 02:05    [W:0.030 / U:5.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site