From: Brian Gerst <bgerst@didntduck.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: davej@codemonkey.org.uk, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Fix warning in powernow-k8.c
Date: Fri, 03 Jun 2005 14:31:48 -0400 [thread overview]
Message-ID: <42A0A214.6070307@didntduck.org> (raw)
In-Reply-To: <20050603161132.GB5083@elf.ucw.cz>
Pavel Machek wrote:
> Hi!
>
>
>>Fix this warning:
>>powernow-k8.c: In function ?query_current_values_with_pending_wait?:
>>powernow-k8.c:110: warning: ?hi? may be used uninitialized in this
>>function
>
>
> Are you sure?
>
> Original code is clearly buggy; I do not think you need that ugly do
> {} while loop.
I'm not sure why you think the loop is ugly. It makes it more obvious
(to us humans and the compiler) that the loop is executed at least one time.
>
> Pavel
>
>>Signed-off-by: Brian Gerst <bgerst@didntduck.org>
>
>
>>diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
>>--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
>>+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
>>@@ -110,14 +110,13 @@ static int query_current_values_with_pen
>> u32 lo, hi;
>> u32 i = 0;
>>
>>- lo = MSR_S_LO_CHANGE_PENDING;
>>- while (lo & MSR_S_LO_CHANGE_PENDING) {
>>+ do {
>> if (i++ > 0x1000000) {
>> printk(KERN_ERR PFX "detected change pending stuck\n");
>> return 1;
>> }
>> rdmsr(MSR_FIDVID_STATUS, lo, hi);
>>- }
>>+ } while (lo & MSR_S_LO_CHANGE_PENDING);
>>
>> data->currvid = hi & MSR_S_HI_CURRENT_VID;
>> data->currfid = lo & MSR_S_LO_CURRENT_FID;
>
>
>
next prev parent reply other threads:[~2005-06-03 18:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-02 16:58 [PATCH] Fix warning in powernow-k8.c Brian Gerst
2005-06-03 16:11 ` Pavel Machek
2005-06-03 18:31 ` Brian Gerst [this message]
2005-06-03 18:56 ` Pavel Machek
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=42A0A214.6070307@didntduck.org \
--to=bgerst@didntduck.org \
--cc=davej@codemonkey.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/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