Skip to content

Commit

Permalink
mtd: map: Fix compilation warning
Browse files Browse the repository at this point in the history
This patch is an attempt to fix following compilation warning.

In file included from drivers/mtd/chips/cfi_cmdset_0001.c:35:0:
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 [-Wmaybe-uninitialized]

I could have used uninitialized_var() too, but didn't used it as the final else
part of map_word_load() is missing. So there is a chance that it might be passed
uninitialized. Better initialize to zero.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
  • Loading branch information
Viresh Kumar authored and Artem Bityutskiy committed Nov 15, 2012
1 parent 9ef525a commit 3e9ce49
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 @@ -328,7 +328,7 @@ static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word

static inline map_word map_word_load(struct map_info *map, const void *ptr)
{
map_word r;
map_word r = {{0} };

if (map_bankwidth_is_1(map))
r.x[0] = *(unsigned char *)ptr;
Expand Down

0 comments on commit 3e9ce49

Please sign in to comment.