2009-07-15 02:20:57

by Subrata Modak

[permalink] [raw]
Subject: [PATCH 05/06] Fix compilation warning for arch/x86/kernel/apm_32.c

Following fix is inspired by David Howells fix few days back:
http://lkml.org/lkml/2009/7/9/109,

Signed-off-by: Subrata Modak<[email protected]>,
---

--- a/arch/x86/kernel/apm_32.c 2009-06-15 07:50:51.000000000 +0530
+++ b/arch/x86/kernel/apm_32.c 2009-07-15 06:43:59.000000000 +0530
@@ -811,7 +811,7 @@ static int apm_do_idle(void)
u8 ret = 0;
int idled = 0;
int polling;
- int err;
+ int uninitialized_var(err);

polling = !!(current_thread_info()->status & TS_POLLING);
if (polling) {

---
Regards--
Subrata


2009-07-18 14:14:31

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 05/06] Fix compilation warning for arch/x86/kernel/apm_32.c


* Subrata Modak <[email protected]> wrote:

> Following fix is inspired by David Howells fix few days back:
> http://lkml.org/lkml/2009/7/9/109,
>
> Signed-off-by: Subrata Modak<[email protected]>,
> ---
>
> --- a/arch/x86/kernel/apm_32.c 2009-06-15 07:50:51.000000000 +0530
> +++ b/arch/x86/kernel/apm_32.c 2009-07-15 06:43:59.000000000 +0530
> @@ -811,7 +811,7 @@ static int apm_do_idle(void)
> u8 ret = 0;
> int idled = 0;
> int polling;
> - int err;
> + int uninitialized_var(err);

Please dont use uninitialized_var() as it's dangerous - in something
as performance-uncritical as this we should initialize it to 0 and
mention it in the changelog that this works around a GCC false
positive warning.

Thanks,

Ingo

2009-07-21 02:34:05

by Subrata Modak

[permalink] [raw]
Subject: Re: [PATCH 05/06] Fix compilation warning for arch/x86/kernel/apm_32.c

On Sat, 2009-07-18 at 16:13 +0200, Ingo Molnar wrote:
> * Subrata Modak <[email protected]> wrote:
>
> > Following fix is inspired by David Howells fix few days back:
> > http://lkml.org/lkml/2009/7/9/109,
> >
> > Signed-off-by: Subrata Modak<[email protected]>,
> > ---
> >
> > --- a/arch/x86/kernel/apm_32.c 2009-06-15 07:50:51.000000000 +0530
> > +++ b/arch/x86/kernel/apm_32.c 2009-07-15 06:43:59.000000000 +0530
> > @@ -811,7 +811,7 @@ static int apm_do_idle(void)
> > u8 ret = 0;
> > int idled = 0;
> > int polling;
> > - int err;
> > + int uninitialized_var(err);
>
> Please dont use uninitialized_var() as it's dangerous - in something
> as performance-uncritical as this we should initialize it to 0 and
> mention it in the changelog that this works around a GCC false
> positive warning.

Sure. Resending as you suggested.

Regards--
Subrata

>
> Thanks,
>
> Ingo