aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Ware <mware@elphinstone.net>2010-05-26 21:45:39 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-08-04 05:56:06 -0400
commitc9fb67735b307a3cdf57e568b6c50c860248d1d3 (patch)
treee29ce16472698497bf28081eaeaae139e06b7c4d /drivers
parent7b0507eb697ea157533b9a7e0a955f64a00b1b1d (diff)
mtd: doc2000: fix uninitialized variable in doc_ecc_decode()
The variable 'syn' was being used uninitialized. Also fixed incorrect use of syn[] vs s[]. Tested on powerpc board with 64MiB DOC2000. Signed-off-by: Mark Ware <mware@elphinstone.net> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/diskonchip.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index 47067bc98248..51315f55f905 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -146,6 +146,7 @@ static int doc_ecc_decode(struct rs_control *rs, uint8_t *data, uint8_t *ecc)
146 uint8_t parity; 146 uint8_t parity;
147 uint16_t ds[4], s[5], tmp, errval[8], syn[4]; 147 uint16_t ds[4], s[5], tmp, errval[8], syn[4];
148 148
149 memset(syn, 0, sizeof(syn));
149 /* Convert the ecc bytes into words */ 150 /* Convert the ecc bytes into words */
150 ds[0] = ((ecc[4] & 0xff) >> 0) | ((ecc[5] & 0x03) << 8); 151 ds[0] = ((ecc[4] & 0xff) >> 0) | ((ecc[5] & 0x03) << 8);
151 ds[1] = ((ecc[5] & 0xfc) >> 2) | ((ecc[2] & 0x0f) << 6); 152 ds[1] = ((ecc[5] & 0xfc) >> 2) | ((ecc[2] & 0x0f) << 6);
@@ -169,9 +170,9 @@ static int doc_ecc_decode(struct rs_control *rs, uint8_t *data, uint8_t *ecc)
169 s[i] ^= rs->alpha_to[rs_modnn(rs, tmp + (FCR + i) * j)]; 170 s[i] ^= rs->alpha_to[rs_modnn(rs, tmp + (FCR + i) * j)];
170 } 171 }
171 172
172 /* Calc s[i] = s[i] / alpha^(v + i) */ 173 /* Calc syn[i] = s[i] / alpha^(v + i) */
173 for (i = 0; i < NROOTS; i++) { 174 for (i = 0; i < NROOTS; i++) {
174 if (syn[i]) 175 if (s[i])
175 syn[i] = rs_modnn(rs, rs->index_of[s[i]] + (NN - FCR - i)); 176 syn[i] = rs_modnn(rs, rs->index_of[s[i]] + (NN - FCR - i));
176 } 177 }
177 /* Call the decoder library */ 178 /* Call the decoder library */