From: Schlaegl Manfred jun Date: Tue, 20 Jan 2009 15:57:55 +0000 (+0100) Subject: nand read.jffs2 (nand_legacy) in common/cmd_nand.c X-Git-Tag: v2009.03-rc1~200^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=389e6620e2271096df3316917528003627db4021;p=oweals%2Fu-boot.git nand read.jffs2 (nand_legacy) in common/cmd_nand.c 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. Signed-off-by: Scott Wood --- diff --git a/common/cmd_nand.c b/common/cmd_nand.c index a240c37b76..3d434e8a70 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -856,13 +856,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"))