Subject: Re: [patch 1/2] powerpc: Sky CPU: redundant or incorrect tests on unsigned

From: Benjamin Herrenschmidt <[email-masked]>
Date: Thu, 04 Feb 2010 10:21:27 +1100

On Tue, 2010-02-02 at 14:40 -0800, [email-masked] wrote:
> From: Roel Kluin <[email-masked]>
> 
> count is unsigned and cannot be less than 0.
> 
> Signed-off-by: Roel Kluin <[email-masked]>
> Acked-by: Cyrill Gorcunov <[email-masked]>
> Cc: Benjamin Herrenschmidt <[email-masked]>
> Cc: Kumar Gala <[email-masked]>
> Cc: Brian Waite <[email-masked]>
> Signed-off-by: Andrew Morton <[email-masked]>
> ---

I still have a hard time figuring out what this sky CPU actually is :-) 

The whole drivers/misc/hdpuftrs is only built when CONFIG_HDPU_FEATURES
is set and git grep HDPU_FEATURES doesn't show anybody ever setting
it :-)

Is that just dead code ? I'm happy to carry it in powerpc.git if you
wish so but you it would be nice to figure out what's going on there...

Cheers,
Ben.

>  drivers/misc/hdpuftrs/hdpu_cpustate.c |    5 -----
>  1 file changed, 5 deletions(-)
> 
> diff -puN drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned drivers/misc/hdpuftrs/hdpu_cpustate.c
> --- a/drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned
> +++ a/drivers/misc/hdpuftrs/hdpu_cpustate.c
> @@ -121,8 +121,6 @@ static ssize_t cpustate_read(struct file
>  {
>  	unsigned char data;
>  
> -	if (count < 0)
> -		return -EFAULT;
>  	if (count == 0)
>  		return 0;
>  
> @@ -137,9 +135,6 @@ static ssize_t cpustate_write(struct fil
>  {
>  	unsigned char data;
>  
> -	if (count < 0)
> -		return -EFAULT;
> -
>  	if (count == 0)
>  		return 0;
>  
> _