Skip to contentSkip to conversation

mtd: nand: Fix length bug in ioread16_rep() and iowrite16_rep()

PATCH New Stefan Roese 2 participants 3 messages Sep 5, 2014 – Sep 24, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: nand: Fix length bug in ioread16_rep() and iowrite16_rep()

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.

Cc Heiko Schocher <[email protected]>
Cc Tom Rini <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_base.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/nand/nand_base.c +1 -3
index 085b154..c378e2a 100644
@@ -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);
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 mtd: nand: Fix length bug in ioread16_rep() and iowrite16_rep()

Hello Stefan,

Am 05.09.2014 09:57, schrieb Stefan Roese:

Quoted 7 lines

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.

Quoted 7 lines
Cc Heiko Schocher<[email protected]>
Cc Tom Rini<[email protected]>
Cc Scott Wood<[email protected]>
---
  drivers/mtd/nand/nand_base.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

Good catch, thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#2 lore raw

PATCH 1/1 mtd: nand: Fix length bug in ioread16_rep() and iowrite16_rep()

Hi Scott, Hi Tom,

Quoted 17 lines · Heiko Schocher
Quoted 9 lines

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.

Quoted 7 lines
Cc Heiko Schocher<[email protected]>
Cc Tom Rini<[email protected]>
Cc Scott Wood<[email protected]>
---
  drivers/mtd/nand/nand_base.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 3 lines

Good catch, thanks!

This patch is also still missing. We really should add it in this upcoming release.

Thanks,
Stefan