linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: fix uninitialised error in numa.c
@ 2012-06-20  4:17 Michael Neuling
  2012-06-20  5:38 ` Tony Breeds
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Neuling @ 2012-06-20  4:17 UTC (permalink / raw)
  To: benh, Jimi Xenidis; +Cc: linuxppc-dev

chroma_defconfig currently gives me this with gcc 4.6:
  arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]

It's a bogus warning since of_get_drconf_memory() only writes it
anyway.  

Signed-off-by: Michael Neuling <mikey@neuling.org>
cc: stable@kernel.org
---
Also affects 3.4 and 3.3 stable.

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5ca3a15..880acde 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
  */
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *dm = NULL, *usm;
 	unsigned int n, rc, ranges, is_kexec_kdump = 0;
 	unsigned long lmb_size, base, size, sz;
 	int nid;

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

* Re: [PATCH] powerpc: fix uninitialised error in numa.c
  2012-06-20  4:17 [PATCH] powerpc: fix uninitialised error in numa.c Michael Neuling
@ 2012-06-20  5:38 ` Tony Breeds
  2012-06-20  5:46   ` Michael Neuling
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Breeds @ 2012-06-20  5:38 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev

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

On Wed, Jun 20, 2012 at 02:17:47PM +1000, Michael Neuling wrote:
> chroma_defconfig currently gives me this with gcc 4.6:
>   arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]
> 
> It's a bogus warning since of_get_drconf_memory() only writes it
> anyway.  
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> cc: stable@kernel.org
> ---
> Also affects 3.4 and 3.3 stable.
> 
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 5ca3a15..880acde 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
>   */
>  static void __init parse_drconf_memory(struct device_node *memory)
>  {
> -	const u32 *dm, *usm;
> +	const u32 *dm = NULL, *usm;

Woot bikeshed!  I think that's what the uninitialized_var() macro is for.

Yours Tony

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] powerpc: fix uninitialised error in numa.c
  2012-06-20  5:38 ` Tony Breeds
@ 2012-06-20  5:46   ` Michael Neuling
  2012-06-20  6:01     ` Michael Neuling
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Neuling @ 2012-06-20  5:46 UTC (permalink / raw)
  To: Tony Breeds; +Cc: linuxppc-dev

Tony Breeds <tony@bakeyournoodle.com> wrote:

> On Wed, Jun 20, 2012 at 02:17:47PM +1000, Michael Neuling wrote:
> > chroma_defconfig currently gives me this with gcc 4.6:
> >   arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]
> > 
> > It's a bogus warning since of_get_drconf_memory() only writes it
> > anyway.  
> > 
> > Signed-off-by: Michael Neuling <mikey@neuling.org>
> > cc: stable@kernel.org
> > ---
> > Also affects 3.4 and 3.3 stable.
> > 
> > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> > index 5ca3a15..880acde 100644
> > --- a/arch/powerpc/mm/numa.c
> > +++ b/arch/powerpc/mm/numa.c
> > @@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
> >   */
> >  static void __init parse_drconf_memory(struct device_node *memory)
> >  {
> > -	const u32 *dm, *usm;
> > +	const u32 *dm = NULL, *usm;
> 
> Woot bikeshed!  I think that's what the uninitialized_var() macro is for.

Doesn't work here.  Produces the same error.

Mikey

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

* [PATCH] powerpc: fix uninitialised error in numa.c
  2012-06-20  5:46   ` Michael Neuling
@ 2012-06-20  6:01     ` Michael Neuling
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Neuling @ 2012-06-20  6:01 UTC (permalink / raw)
  To: benh, Jimi Xenidis; +Cc: linuxppc-dev

chroma_defconfig currently gives me this with gcc 4.6:
  arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]

It's a bogus warning/error since of_get_drconf_memory() only writes it
anyway.

Signed-off-by: Michael Neuling <mikey@neuling.org>
cc: stable@kernel.org
---
> > >  static void __init parse_drconf_memory(struct device_node *memory)
> > >  {
> > > -	const u32 *dm, *usm;
> > > +	const u32 *dm = NULL, *usm;
> > 
> > Woot bikeshed!  I think that's what the uninitialized_var() macro is for.
> 
> Doesn't work here.  Produces the same error.

My bad.. I was using it wrong

Still affects 3.4 and 3.3 stable.

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5ca3a15..7c28589 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
  */
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *uninitialized_var(dm), *usm;
 	unsigned int n, rc, ranges, is_kexec_kdump = 0;
 	unsigned long lmb_size, base, size, sz;
 	int nid;

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

end of thread, other threads:[~2012-06-20  6:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-20  4:17 [PATCH] powerpc: fix uninitialised error in numa.c Michael Neuling
2012-06-20  5:38 ` Tony Breeds
2012-06-20  5:46   ` Michael Neuling
2012-06-20  6:01     ` Michael Neuling

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