LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: lsorense@csclub.uwaterloo.ca (Lennart Sorensen)
To: takada <takada@mbf.nifty.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: fix typo in geode_configre()@cyrix.c
Date: Tue, 9 Jan 2007 12:33:48 -0500	[thread overview]
Message-ID: <20070109173348.GF17269@csclub.uwaterloo.ca> (raw)
In-Reply-To: <20070109.184156.260789378.takada@mbf.nifty.com>

On Tue, Jan 09, 2007 at 06:41:56PM +0900, takada wrote:
> In kernel 2.6, write back wrong register when configure Geode processor.
> Instead of storing to CCR4, it stores to CCR3.
> 
> --- linux-2.6.19/arch/i386/kernel/cpu/cyrix.c.orig	2007-01-09 16:45:21.000000000 +0900
> +++ linux-2.6.19/arch/i386/kernel/cpu/cyrix.c	2007-01-09 17:10:13.000000000 +0900
> @@ -173,7 +173,7 @@ static void __cpuinit geode_configure(vo
>  	ccr4 = getCx86(CX86_CCR4);
>  	ccr4 |= 0x38;		/* FPU fast, DTE cache, Mem bypass */
>  	
> -	setCx86(CX86_CCR3, ccr3);
> +	setCx86(CX86_CCR4, ccr4);
>  	
>  	set_cx86_memwb();
>  	set_cx86_reorder();	
> -

One more comment on this:

Why is this function using 3 different styles to do the same thing to 3
different registers?

First it does CCR2 by doing:
setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);

Nice, no temp values, and it is obvious this is a permanent change.

Then for the next one it does:
ccr3 = GetCx86(CX86_CCR3);
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);

Couldn't that have been:
setCx86(CX86_CCR3, (getCx86(CX86_CCR3) & 0x0f) | 0x10);

No temp variable, and again it clearly does not intend to restore the
value again later (even though the bug actually did cause the value to
be restored by accident).

Then the last case does:
ccr4 = GetCx86(CX86_CCR4);
ccr4 |= 0x38;
setCx86(CX86_CCR4, ccr4); (after fixing the typo you found of course).

Why did this one have to modify the variable first before using it?
Maybe the ccr3 and ccr4 cases would have made the line too long and
needed wrapping, but at least those two cases should be done the same
way.  It makes it look like it was written by 3 different people who
didn't look at the lines around the changes they were making.

--
Len Sorensen

  parent reply	other threads:[~2007-01-09 17:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-09  9:41 takada
2007-01-09 15:43 ` Lennart Sorensen
2007-01-17  0:15   ` Juergen Beisert
2007-01-09 17:33 ` Lennart Sorensen [this message]
2007-01-16 16:38   ` takada
2007-01-16 16:50     ` Lennart Sorensen
2007-01-16 17:12       ` takada
2007-01-24  4:04         ` Andrew Morton
2007-01-16 22:47     ` Lennart Sorensen
2007-01-17  0:24   ` Juergen Beisert
2007-01-17 15:26   ` takada

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=20070109173348.GF17269@csclub.uwaterloo.ca \
    --to=lsorense@csclub.uwaterloo.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=takada@mbf.nifty.com \
    --subject='Re: fix typo in geode_configre()@cyrix.c' \
    /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

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).