Patchwork mtd: fix compile warning with newer GCC in flash maps

login
register
mail settings
Submitter Jamie Iles
Date Aug. 23, 2011, 9:27 a.m.
Message ID <1314091670-15175-1-git-send-email-jamie@jamieiles.com>
Download mbox | patch
Permalink /patch/111065/
State New
Headers show

Comments

Jamie Iles - Aug. 23, 2011, 9:27 a.m.
For invalid map bankwidths, BUG() out for map_word_load() and
inline_map_write() like inline_map_read() does.  This fixes the warning
below and for other maps.

drivers/mtd/chips/cfi_cmdset_0002.c: In function 'cfi_amdstd_write_words':
include/linux/mtd/map.h:330:11: warning: 'r$x$0' may be used uninitialized in this function

Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 include/linux/mtd/map.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index a9e6ba4..cbc5a3d 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -341,6 +341,8 @@  static inline map_word map_word_load(struct map_info *map, const void *ptr)
 #endif
 	else if (map_bankwidth_is_large(map))
 		memcpy(r.x, ptr, map->bankwidth);
+	else
+		BUG();
 
 	return r;
 }
@@ -424,6 +426,9 @@  static inline void inline_map_write(struct map_info *map, const map_word datum,
 #endif
 	else if (map_bankwidth_is_large(map))
 		memcpy_toio(map->virt+ofs, datum.x, map->bankwidth);
+	else
+		BUG();
+
 	mb();
 }