Skip to content

Commit

Permalink
mtd: uninitialized variable warning in map.h
Browse files Browse the repository at this point in the history
The map_word_load() function initializes exactly
as many words in the buffer as required, but gcc
cannot figure this out and gives a misleading
warning. Marking the local variable as
uninitialized_var shuts up that warning.

Without this patch, building acs5k_defconfig results in:

drivers/mtd/chips/cfi_cmdset_0002.c: In function 'cfi_amdstd_panic_write':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]
drivers/mtd/chips/cfi_cmdset_0002.c: In function 'cfi_amdstd_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]
drivers/mtd/chips/cfi_cmdset_0001.c: In function 'cfi_intelext_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
  • Loading branch information
Arnd Bergmann authored and Artem Bityutskiy committed Nov 16, 2012
1 parent d611d41 commit 5d27aa5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/mtd/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,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 uninitialized_var(r);

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

0 comments on commit 5d27aa5

Please sign in to comment.