[U-Boot] [PATCH] mtd: nand: Fix length bug in ioread16_rep() and iowrite16_rep()

Stefan Roese sr at denx.de
Fri Sep 5 09:57:01 CEST 2014


The ioread16_rep() and iowrite16_rep() implementations are U-Boot specific
and have been introduced with the Linux MTD v3.14 sync. While introducing
these functions, the length for the loop has been miscalculated. The ">> 1"
is already present in the caller. So lets remove it in the function.

Tested on omap3_ha.

Signed-off-by: Stefan Roese <sr at denx.de>
Cc: Heiko Schocher <hs at denx.de>
Cc: Tom Rini <trini at ti.com>
Cc: Scott Wood <scottwood at freescale.com>
---
 drivers/mtd/nand/nand_base.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 085b154..c378e2a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -309,8 +309,7 @@ static void ioread16_rep(void *addr, void *buf, int len)
 {
 	int i;
  	u16 *p = (u16 *) buf;
-	len >>= 1;
- 
+
 	for (i = 0; i < len; i++)
 		p[i] = readw(addr);
 }
@@ -319,7 +318,6 @@ static void iowrite16_rep(void *addr, void *buf, int len)
 {
 	int i;
         u16 *p = (u16 *) buf;
-        len >>= 1;
 
         for (i = 0; i < len; i++)
                 writew(p[i], addr);
-- 
2.1.0



More information about the U-Boot mailing list