public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] nand read.jffs2 (nand_legacy) in common/cmd_nand.c
@ 2009-01-20 15:57 Schlaegl Manfred jun.
  2009-01-20 18:09 ` Scott Wood
  0 siblings, 1 reply; 5+ messages in thread
From: Schlaegl Manfred jun. @ 2009-01-20 15:57 UTC (permalink / raw)
  To: u-boot

Hi!

Error with CONFIG_NAND_LEGACY in common/cmd_nand.c:
With current code "nand read.jffs2s" (read and skip bad blocks) is always interpreted as 
"nand read.jffs2" (read and fill bad blocks with 0xff). This is because ".jffs2" is 
tested before ".jffs2s" and only the first two characters are compared.

Correction:
Test for ".jffs2s" first and compare the first 7 characters.

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 0a366d3..ba1b27f 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -854,13 +854,12 @@ int do_nand (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 							      (u_char *) addr);
 				}
 				return ret;
-			} else if (cmdtail && !strncmp (cmdtail, ".jffs2", 2))
-				cmd |= NANDRW_JFFS2;	/* skip bad blocks */
-			else if (cmdtail && !strncmp (cmdtail, ".jffs2s", 2)) {
+			} else if (cmdtail && !strncmp (cmdtail, ".jffs2s", 7)) {
 				cmd |= NANDRW_JFFS2;	/* skip bad blocks (on read too) */
 				if (cmd & NANDRW_READ)
 					cmd |= NANDRW_JFFS2_SKIP;	/* skip bad blocks (on read too) */
-			}
+			} else if (cmdtail && !strncmp (cmdtail, ".jffs2", 2))
+				cmd |= NANDRW_JFFS2;	/* skip bad blocks */
 #ifdef SXNI855T
 			/* need ".e" same as ".j" for compatibility with older units */
 			else if (cmdtail && !strcmp (cmdtail, ".e"))


Signed-off-by: Manfred Schlaegl jun. <manfred.schlaegl@gmx.at>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-20 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-20 15:57 [U-Boot] [PATCH] nand read.jffs2 (nand_legacy) in common/cmd_nand.c Schlaegl Manfred jun.
2009-01-20 18:09 ` Scott Wood
2009-01-20 18:14   ` Scott Wood
2009-01-20 18:32   ` Stefan Roese
2009-01-20 19:35     ` [U-Boot] Legacy NAND support to be removed after April 2009; please update your boards Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox