Skip to contentSkip to conversation

NAND: Have nboot accept .e and .i as legacy no-ops.

PATCH New Scott Wood 2 participants 4 messages Mar 17, 2009

lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 1/1 NAND: Have nboot accept .e and .i as legacy no-ops.

This was intended to happen before, but a trivial bug prevented it.

---
Applied to u-boot-nand-flash.

 common/cmd_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_nand.c +1 -1
index f915fb6..e6623ca 100644
@@ -502,7 +502,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 
 	s = strchr(cmd, '.');
 	if (s != NULL &&
-	    (strcmp(s, ".jffs2") && !strcmp(s, ".e") && !strcmp(s, ".i"))) {
+	    (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {
 		printf("Unknown nand load suffix '%s'\n", s);
 		show_boot_progress(-53);
 		return 1;
Signature · 1 line
1.5.3
#1 lore raw

PATCH 1/1 NAND: Have nboot accept .e and .i as legacy no-ops.

common/cmd_nand.c static int nand_load_image(cmd_tbl_t *cmdtp, · line 506

Quoted 9 lines · On Tuesday 17 March 2009 13:10:15 Scott Wood wrote:
common/cmd_nand.c +1 -1
@@ -502,7 +502,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp,
 nand_info_t *nand,
 
 	s = strchr(cmd, '.');
 	if (s != NULL &&
-	    (strcmp(s, ".jffs2") && !strcmp(s, ".e") && !strcmp(s, ".i"))) {
+	    (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {

unrelated to the bug in question, but perhaps better written like:
if (s++ != NULL &&

    (strcmp(s, "jffs2") && strcmp(s, "e") && strcmp(s, "i"))) {

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090317/ae08507d/attachment-0001.pgp

author
#2 lore raw

PATCH 1/1 NAND: Have nboot accept .e and .i as legacy no-ops.

Quoted 6 lines · Mike Frysinger
Quoted 5 lines · On Tuesday 17 March 2009 13:10:15 Scott Wood wrote:
common/cmd_nand.c +0 -0
@@ -502,7 +502,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp,
 nand_info_t *nand,
 
Quoted 8 lines

common/cmd_nand.c static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, · line 505

Quoted 4 lines
common/cmd_nand.c +1 -1
 	s = strchr(cmd, '.');
 	if (s != NULL &&
-	    (strcmp(s, ".jffs2") && !strcmp(s, ".e") && !strcmp(s, ".i"))) {
+	    (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {

unrelated to the bug in question, but perhaps better written like:
if (s++ != NULL &&

    (strcmp(s, "jffs2") && strcmp(s, "e") && strcmp(s, "i"))) {

That'd make s non-NULL and invalid, if it started out as NULL. Even if s is not referenced again, it's not a nice thing to leave lurking in the code.

-Scott

#3 lore raw

PATCH 1/1 NAND: Have nboot accept .e and .i as legacy no-ops.

Quoted 16 lines · On Tuesday 17 March 2009 13:55:18 Scott Wood wrote:
Quoted 6 lines · Mike Frysinger
Quoted 5 lines · On Tuesday 17 March 2009 13:10:15 Scott Wood wrote:
common/cmd_nand.c +0 -0
@@ -502,7 +502,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp,
 nand_info_t *nand,
 
Quoted 8 lines

common/cmd_nand.c static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, · line 505

Quoted 4 lines
common/cmd_nand.c +1 -1
 	s = strchr(cmd, '.');
 	if (s != NULL &&
-	    (strcmp(s, ".jffs2") && !strcmp(s, ".e") && !strcmp(s, ".i"))) {
+	    (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {

unrelated to the bug in question, but perhaps better written like:
if (s++ != NULL &&

    (strcmp(s, "jffs2") && strcmp(s, "e") && strcmp(s, "i"))) {
Quoted 3 lines

That'd make s non-NULL and invalid, if it started out as NULL. Even if s is not referenced again, it's not a nice thing to leave lurking in the code.

i know it does, but since s isnt used again in the code in the NULL case, it doesnt matter. but if you want to be pedantic, it's easy enough to split the operations.
if (s != NULL && ++s && ....
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090317/6f863368/attachment.pgp