mtd: cfi_cmdset_0002: Initialize datum before calling map_word_load_partial
authorChristian Riesch <christian.riesch@omicron.at>
Tue, 31 Mar 2015 21:29:22 +0000 (23:29 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 27 May 2015 19:47:37 +0000 (12:47 -0700)
In do_otp_write we must initialize the variable datum before calling
map_word_load_partial. Otherwise the upper bits of datum may be undefined,
which later causes problems in chip_good called by do_write_oneword.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/chips/cfi_cmdset_0002.c

index c50d8cf0f60dd01b0b6c25822788b53dd2884bfd..c3624eb571d16f0067acc8137e8654f1bf829a37 100644 (file)
@@ -1295,7 +1295,7 @@ static int do_otp_write(struct map_info *map, struct flchip *chip, loff_t adr,
                unsigned long bus_ofs = adr & ~(map_bankwidth(map)-1);
                int gap = adr - bus_ofs;
                int n = min_t(int, len, map_bankwidth(map) - gap);
-               map_word datum;
+               map_word datum = map_word_ff(map);
 
                if (n != map_bankwidth(map)) {
                        /* partial write of a word, load old contents */