From: rui.zhang@intel.com (Zhang Rui)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] thermal: cpu_cooling: fix 'descend' check in get_property()
Date: Tue, 28 May 2013 14:48:16 +0800 [thread overview]
Message-ID: <1369723696.2083.44.camel@rzhang1-mobl4> (raw)
In-Reply-To: <1369722152-9732-1-git-send-email-shawn.guo@linaro.org>
On Tue, 2013-05-28 at 14:22 +0800, Shawn Guo wrote:
> The variable 'descend' is initialized as -1 in function get_property(),
> and will never get any chance to be updated by the following code.
>
> if (freq != CPUFREQ_ENTRY_INVALID && descend != -1)
> descend = !!(freq > table[i].frequency);
>
> This makes function get_property() return the wrong frequency for given
> cooling level if the frequency table is sorted in ascending. Fix it
> by correcting the 'descend' check in if-condition to 'descend == -1'.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
good catch!
patch applied to thermal -next.
thanks,
rui
> ---
> drivers/thermal/cpu_cooling.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index c94bf2e..82e15db 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -167,7 +167,7 @@ static int get_property(unsigned int cpu, unsigned long input,
> continue;
>
> /* get the frequency order */
> - if (freq != CPUFREQ_ENTRY_INVALID && descend != -1)
> + if (freq != CPUFREQ_ENTRY_INVALID && descend == -1)
> descend = !!(freq > table[i].frequency);
>
> freq = table[i].frequency;
prev parent reply other threads:[~2013-05-28 6:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-28 6:22 [PATCH] thermal: cpu_cooling: fix 'descend' check in get_property() Shawn Guo
2013-05-28 6:48 ` Zhang Rui [this message]
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=1369723696.2083.44.camel@rzhang1-mobl4 \
--to=rui.zhang@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).