* [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count
@ 2009-03-04 19:55 akpm
2009-03-16 3:36 ` Len Brown
2009-03-17 5:19 ` Len Brown
0 siblings, 2 replies; 4+ messages in thread
From: akpm @ 2009-03-04 19:55 UTC (permalink / raw)
To: lenb; +Cc: linux-acpi, akpm, roel.kluin, yakui.zhao
From: Roel Kluin <roel.kluin@gmail.com>
With for(i = 0; i < n; i++) { ... } i reaches n.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: <yakui.zhao@intel.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
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;
}
_
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count
2009-03-04 19:55 [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count akpm
@ 2009-03-16 3:36 ` Len Brown
2009-03-16 5:27 ` yakui_zhao
2009-03-17 5:19 ` Len Brown
1 sibling, 1 reply; 4+ messages in thread
From: Len Brown @ 2009-03-16 3:36 UTC (permalink / raw)
To: akpm; +Cc: linux-acpi, roel.kluin, yakui.zhao
--
Len Brown, Intel Open Source Technology Center
On Wed, 4 Mar 2009, akpm@linux-foundation.org wrote:
> From: Roel Kluin <roel.kluin@gmail.com>
>
> With for(i = 0; i < n; i++) { ... } i reaches n.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> Acked-by: <yakui.zhao@intel.com>
> Cc: Len Brown <lenb@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> 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...
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,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count
2009-03-16 3:36 ` Len Brown
@ 2009-03-16 5:27 ` yakui_zhao
0 siblings, 0 replies; 4+ messages in thread
From: yakui_zhao @ 2009-03-16 5:27 UTC (permalink / raw)
To: Len Brown
Cc: akpm@linux-foundation.org, linux-acpi@vger.kernel.org,
roel.kluin@gmail.com
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@linux-foundation.org wrote:
>
> > From: Roel Kluin <roel.kluin@gmail.com>
> >
> > With for(i = 0; i < n; i++) { ... } i reaches n.
> >
> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> > Acked-by: <yakui.zhao@intel.com>
> > Cc: Len Brown <lenb@kernel.org>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> >
> > 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,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count
2009-03-04 19:55 [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count akpm
2009-03-16 3:36 ` Len Brown
@ 2009-03-17 5:19 ` Len Brown
1 sibling, 0 replies; 4+ messages in thread
From: Len Brown @ 2009-03-17 5:19 UTC (permalink / raw)
To: akpm; +Cc: linux-acpi, roel.kluin, yakui.zhao
Andrew,
you'll want to drop this one from your series
b/c I checked in the simpler version.
thanks,
Len Brown, Intel Open Source Technology Center
On Wed, 4 Mar 2009, akpm@linux-foundation.org wrote:
> From: Roel Kluin <roel.kluin@gmail.com>
>
> With for(i = 0; i < n; i++) { ... } i reaches n.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> Acked-by: <yakui.zhao@intel.com>
> Cc: Len Brown <lenb@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> 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;
> }
> _
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-17 5:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-04 19:55 [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count akpm
2009-03-16 3:36 ` Len Brown
2009-03-16 5:27 ` yakui_zhao
2009-03-17 5:19 ` Len Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.