aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/r852.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 325930db3f04..baea83f4dea8 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -245,7 +245,7 @@ static void r852_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
245 } 245 }
246 246
247 /* write DWORD chinks - faster */ 247 /* write DWORD chinks - faster */
248 while (len) { 248 while (len >= 4) {
249 reg = buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24; 249 reg = buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
250 r852_write_reg_dword(dev, R852_DATALINE, reg); 250 r852_write_reg_dword(dev, R852_DATALINE, reg);
251 buf += 4; 251 buf += 4;
@@ -254,8 +254,10 @@ static void r852_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
254 } 254 }
255 255
256 /* write rest */ 256 /* write rest */
257 while (len) 257 while (len > 0) {
258 r852_write_reg(dev, R852_DATALINE, *buf++); 258 r852_write_reg(dev, R852_DATALINE, *buf++);
259 len--;
260 }
259} 261}
260 262
261/* 263/*