2010-04-09 23:14:11

by root

[permalink] [raw]
Subject: [PATCH] MTD: Suppress warnings in inline_map_read()

With gcc 4.4.3 -O2 on MIPS32:

drivers/mtd/chips/cfi_util.c: In function 'cfi_qry_present':
include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
include/linux/mtd/map.h:375: note: 'r' was declared here
include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
include/linux/mtd/map.h:375: note: 'r' was declared here

Signed-off-by: Kevin Cernekee <[email protected]>
---
include/linux/mtd/map.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index b981b87..74f0277 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -372,7 +372,7 @@ static inline map_word map_word_ff(struct map_info *map)

static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
{
- map_word r;
+ map_word r = { { 0 } };

if (map_bankwidth_is_1(map))
r.x[0] = __raw_readb(map->virt + ofs);
--
1.6.3.1


2010-04-10 09:27:13

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH] MTD: Suppress warnings in inline_map_read()

On Fri, 2010-04-09 at 15:45 -0700, Kevin Cernekee wrote:
> With gcc 4.4.3 -O2 on MIPS32:
>
> drivers/mtd/chips/cfi_util.c: In function 'cfi_qry_present':
> include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
> include/linux/mtd/map.h:375: note: 'r' was declared here
> include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
> include/linux/mtd/map.h:375: note: 'r' was declared here
>
> Signed-off-by: Kevin Cernekee <[email protected]>

I suspect 'else BUG()' would be a better fix.

--
David Woodhouse Open Source Technology Centre
[email protected] Intel Corporation

2010-04-10 18:37:35

by Kevin Cernekee

[permalink] [raw]
Subject: [PATCHv2] MTD: Suppress warnings in inline_map_read()

With gcc 4.4.3 -O2 on MIPS32:

drivers/mtd/chips/cfi_util.c: In function 'cfi_qry_present':
include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
include/linux/mtd/map.h:375: note: 'r' was declared here
include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
include/linux/mtd/map.h:375: note: 'r' was declared here

Signed-off-by: Kevin Cernekee <[email protected]>
---
include/linux/mtd/map.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index b981b87..56a4592 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -386,6 +386,8 @@ static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
#endif
else if (map_bankwidth_is_large(map))
memcpy_fromio(r.x, map->virt+ofs, map->bankwidth);
+ else
+ BUG();

return r;
}
--
1.6.3.1

2010-04-27 07:50:47

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCHv2] MTD: Suppress warnings in inline_map_read()

On Sat, 2010-04-10 at 11:18 -0700, Kevin Cernekee wrote:
> With gcc 4.4.3 -O2 on MIPS32:
>
> drivers/mtd/chips/cfi_util.c: In function 'cfi_qry_present':
> include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
> include/linux/mtd/map.h:375: note: 'r' was declared here
> include/linux/mtd/map.h:390: warning: 'r' may be used uninitialized in this function
> include/linux/mtd/map.h:375: note: 'r' was declared here
>
> Signed-off-by: Kevin Cernekee <[email protected]>

Pushed to l2-mtd-2.6 / dunno

--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)