Re: [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-03-16 at 11:36 +0800, Len Brown wrote:
> 
> --
> Len Brown, Intel Open Source Technology Center
> 
> On Wed, 4 Mar 2009, akpm@xxxxxxxxxxxxxxxxxxxx wrote:
> 
> > From: Roel Kluin <roel.kluin@xxxxxxxxx>
> > 
> > With for(i = 0; i < n; i++) { ... } i reaches n.
> > 
> > Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> > Acked-by: <yakui.zhao@xxxxxxxxx>
> > Cc: Len Brown <lenb@xxxxxxxxxx>
> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > ---
> > 
> >  drivers/acpi/processor_throttling.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff -puN drivers/acpi/processor_throttling.c~acpi-get_throttling_state-cannot-be-larger-state_count drivers/acpi/processor_throttling.c
> > --- a/drivers/acpi/processor_throttling.c~acpi-get_throttling_state-cannot-be-larger-state_count
> > +++ a/drivers/acpi/processor_throttling.c
> > @@ -785,7 +785,7 @@ static int acpi_get_throttling_state(str
> >  		if (tx->control == value)
> >  			break;
> >  	}
> > -	if (i > pr->throttling.state_count)
> > +	if (i >= pr->throttling.state_count)
> >  		i = -1;
> >  	return i;
> >  }
> > _
> > 
> 
> how about simply...
It is OK to me.
> 
> diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
> index d278381..5f09901 100644
> --- a/drivers/acpi/processor_throttling.c
> +++ b/drivers/acpi/processor_throttling.c
> @@ -783,11 +783,9 @@ static int acpi_get_throttling_state(struct acpi_processor *pr,
>  		    (struct acpi_processor_tx_tss *)&(pr->throttling.
>  						      states_tss[i]);
>  		if (tx->control == value)
> -			break;
> +			return i;
>  	}
> -	if (i > pr->throttling.state_count)
> -		i = -1;
> -	return i;
> +	return -1;
>  }
>  
>  static int acpi_get_throttling_value(struct acpi_processor *pr,

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux