From: Len Brown <lenb@kernel.org>
To: akpm@linux-foundation.org
Cc: linux-acpi@vger.kernel.org, roel.kluin@gmail.com, yakui.zhao@intel.com
Subject: Re: [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count
Date: Sun, 15 Mar 2009 23:36:38 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.2.00.0903152336100.30317@localhost.localdomain> (raw)
In-Reply-To: <200903041955.n24JtRIO027997@imap1.linux-foundation.org>
--
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,
next prev parent reply other threads:[~2009-03-16 3:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2009-03-16 5:27 ` yakui_zhao
2009-03-17 5:19 ` Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.0903152336100.30317@localhost.localdomain \
--to=lenb@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-acpi@vger.kernel.org \
--cc=roel.kluin@gmail.com \
--cc=yakui.zhao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).