lkml.org 
[lkml]   [2008]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] intel_menlo: max_state is unsigned, invalid test
On Wed, 29 Oct 2008 17:06:47 -0400
roel kluin <roel.kluin@gmail.com> wrote:

> max_state is unsigned, so the test is invalid.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> I think max_state can only become -1, no? then probably a different
> patch is required.
> I may not be able to respond for a few weeks.
>
> diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c
> index e00a275..980171d 100644
> --- a/drivers/misc/intel_menlow.c
> +++ b/drivers/misc/intel_menlow.c
> @@ -121,7 +121,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
> if (memory_get_int_max_bandwidth(cdev, &max_state))
> return -EFAULT;
>
> - if (max_state < 0 || state > max_state)
> + if (max_state == -1 || state > max_state)
> return -EINVAL;
>
> arg_list.count = 1;
>

hm, maybe.

This can only happen if acpi_evaluate_integer(MEMORY_GET_BANDWIDTH)
returned no-error and a bandwidth of zero (I assume).

Is this a special case which the driver really wanted to handle? If
so, why is "0" the only bad value which we're checking for? Or is this
all some big brainfart which should be removed?


\
 
 \ /
  Last update: 2008-11-03 23:39    [W:2.112 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site