All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [Patch] check u32 < 0 in cpufreq-nforce2
@ 2005-12-14 12:26 Eric Sesterhenn / snakebyte
  2005-12-14 12:49 ` Jesper Juhl
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Sesterhenn / snakebyte @ 2005-12-14 12:26 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

Hi,

arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c declares
pll as u32 which is unsigned, and checks it agains < 0.
This patch changes it from u32 to s32 so the check
makes sense, nforce2_write_pll() and nforce2_calc_pll()
also expect/return a signed int.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c.orig	2005-12-14 13:19:43.000000000 +0100
+++ arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c	2005-12-14 13:23:40.000000000 +0100
@@ -177,7 +177,8 @@ static unsigned int nforce2_fsb_read(int
  */
 static int nforce2_set_fsb(unsigned int fsb)
 {
-	u32 pll, temp = 0;
+	u32 temp = 0;
+	s32 pll;
 	unsigned int tfsb;
 	int diff;
 



[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [KJ] [Patch] check u32 < 0 in cpufreq-nforce2
  2005-12-14 12:26 [KJ] [Patch] check u32 < 0 in cpufreq-nforce2 Eric Sesterhenn / snakebyte
@ 2005-12-14 12:49 ` Jesper Juhl
  2005-12-14 12:58 ` Eric Sesterhenn / snakebyte
  2005-12-14 13:33 ` Dave Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2005-12-14 12:49 UTC (permalink / raw)
  To: kernel-janitors

On 12/14/05, Eric Sesterhenn / snakebyte <snakebyte@gmx.de> wrote:
> Hi,
>
> arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c declares
> pll as u32 which is unsigned, and checks it agains < 0.
> This patch changes it from u32 to s32 so the check
> makes sense, nforce2_write_pll() and nforce2_calc_pll()
> also expect/return a signed int.
>
> Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
>
> --- arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c.orig 2005-12-14 13:19:43.000000000 +0100
> +++ arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c      2005-12-14 13:23:40.000000000 +0100

Please make patches that can be applied with  patch -p1  that is, run
diff from the directory holding the kernel source dir, not from within
the kernel source dir itself. Also, unless creating your diff that way
makes it obvious what version of the kernel you are patching, please
state the version in your email.


> @@ -177,7 +177,8 @@ static unsigned int nforce2_fsb_read(int
>   */
>  static int nforce2_set_fsb(unsigned int fsb)
>  {
> -       u32 pll, temp = 0;
> +       u32 temp = 0;
> +       s32 pll;
>         unsigned int tfsb;
>         int diff;
>

nforce2_calc_pll() which is used to obtain the value stored in the pll
variable returns a plain 'int', and nforce2_write_pll() which the
value is later passed to also expects a plain 'int', so why not make
the type of pll a plain int instead of s32 ??

Other than that, I agree with you that the variable needs to be signed
since nforce2_calc_pll() returns -1 on failure.

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [KJ] [Patch] check u32 < 0 in cpufreq-nforce2
  2005-12-14 12:26 [KJ] [Patch] check u32 < 0 in cpufreq-nforce2 Eric Sesterhenn / snakebyte
  2005-12-14 12:49 ` Jesper Juhl
@ 2005-12-14 12:58 ` Eric Sesterhenn / snakebyte
  2005-12-14 13:33 ` Dave Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Sesterhenn / snakebyte @ 2005-12-14 12:58 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]

hi,

thanks for the reply

> Please make patches that can be applied with  patch -p1  that is, run
> diff from the directory holding the kernel source dir, not from within
> the kernel source dir itself. Also, unless creating your diff that way
> makes it obvious what version of the kernel you are patching, please
> state the version in your email.

ok, rediffed, kernel ist 2.6.16-rc5-git2

> nforce2_calc_pll() which is used to obtain the value stored in the pll
> variable returns a plain 'int', and nforce2_write_pll() which the
> value is later passed to also expects a plain 'int', so why not make
> the type of pll a plain int instead of s32 ??

i wasnt brave enough, since i am not fully aware of the differences 
between s32 and int. changed it to int.

> Other than that, I agree with you that the variable needs to be signed
> since nforce2_calc_pll() returns -1 on failure.

so such cleanups are ok? the icc compiler spits out some more warnings
regarding this ( not all seem to be a problem ).


Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.15-rc5-git2/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c.orig	2005-12-14 13:19:43.000000000 +0100
+++ linux-2.6.15-rc5-git2/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c	2005-12-14 13:55:06.000000000 +0100
@@ -177,9 +177,9 @@ static unsigned int nforce2_fsb_read(int
  */
 static int nforce2_set_fsb(unsigned int fsb)
 {
-	u32 pll, temp = 0;
+	u32 temp = 0;
 	unsigned int tfsb;
-	int diff;
+	int diff, pll;
 
 	if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) {
 		printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb);



[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [KJ] [Patch] check u32 < 0 in cpufreq-nforce2
  2005-12-14 12:26 [KJ] [Patch] check u32 < 0 in cpufreq-nforce2 Eric Sesterhenn / snakebyte
  2005-12-14 12:49 ` Jesper Juhl
  2005-12-14 12:58 ` Eric Sesterhenn / snakebyte
@ 2005-12-14 13:33 ` Dave Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Jones @ 2005-12-14 13:33 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

On Wed, Dec 14, 2005 at 01:26:49PM +0100, Eric Sesterhenn / snakebyte wrote:
 > Hi,
 > 
 > arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c declares
 > pll as u32 which is unsigned, and checks it agains < 0.
 > This patch changes it from u32 to s32 so the check
 > makes sense, nforce2_write_pll() and nforce2_calc_pll()
 > also expect/return a signed int.
 > 
 > Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

Already fixed in cpufreq.git / -mm
Will go to Linus post 2.6.15

		Dave


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-14 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-14 12:26 [KJ] [Patch] check u32 < 0 in cpufreq-nforce2 Eric Sesterhenn / snakebyte
2005-12-14 12:49 ` Jesper Juhl
2005-12-14 12:58 ` Eric Sesterhenn / snakebyte
2005-12-14 13:33 ` Dave Jones

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.