Skip to contentSkip to conversation

spl: fix calling "spl export .." more than once

PATCH In review Heiko Schocher 3 participants 3 messages Feb 24, 2015 – Mar 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: fix calling "spl export .." more than once

running "spl export ..." more than once fails with:

Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
ERROR prep subcommand failed!
Subcommand failed

reason is commmit:
35fc84fa1f: Refactor the bootm command to reduce code duplication

It used "state != BOOTM_STATE_START" but state is a bitfield, so check if the bit BOOTM_STATE_START is not set. With this fix, "spl export ..." can called more than once ...

---

 common/cmd_bootm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/cmd_bootm.c +2 -1
index 48199bf..4f77f22 100644
@@ -78,7 +78,8 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
 		return CMD_RET_USAGE;
 	}
 
-	if (state != BOOTM_STATE_START && images.state >= state) {
+	if (((state & BOOTM_STATE_START) != BOOTM_STATE_START) &&
+	    images.state >= state) {
 		printf("Trying to execute a command out of order\n");
 		return CMD_RET_USAGE;
 	}
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 spl: fix calling "spl export .." more than once

Hi Heiko,

Quoted 12 lines · Heiko Schocher

running "spl export ..." more than once fails with:

Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
ERROR prep subcommand failed!
Subcommand failed

Quoted 8 lines

reason is commmit:
35fc84fa1f: Refactor the bootm command to reduce code duplication

It used "state != BOOTM_STATE_START" but state is a bitfield, so check if the bit BOOTM_STATE_START is not set. With this fix, "spl export ..." can called more than once ...

The original code expected that only one flag would be passed at once (I think that was always the case when the code was first changed). But that is not how we want it to work.

Quoted 10 lines

---

 common/cmd_bootm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/cmd_bootm.c +0 -0
index 48199bf..4f77f22 100644

common/cmd_bootm.c static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc, · line 81

Quoted 5 lines
common/cmd_bootm.c +1 -1
@@ -78,7 +78,8 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
                return CMD_RET_USAGE;
        }
 
-       if (state != BOOTM_STATE_START && images.state >= state) {
+       if (((state & BOOTM_STATE_START) != BOOTM_STATE_START) &&

Maybe simpler as:

if (!(state & BOOTM_STATE_START) &&

Quoted 8 lines
common/cmd_bootm.c +1 -1
+           images.state >= state) {
                printf("Trying to execute a command out of order\n");
                return CMD_RET_USAGE;
        }
--

2.1.0

Regards,
Simon

#2 lore raw
In reply to Heiko Schocher
Quoted 14 lines · Heiko Schocher

running "spl export ..." more than once fails with:

Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
Trying to execute a command out of order
ERROR prep subcommand failed!
Subcommand failed

reason is commmit:
35fc84fa1f: Refactor the bootm command to reduce code duplication

Quoted 6 lines

It used "state != BOOTM_STATE_START" but state is a bitfield, so check if the bit BOOTM_STATE_START is not set. With this fix, "spl export ..." can called more than once ...

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150306/5a0ca3b6/attachment.sig>