Skip to contentSkip to conversation

cmd_bootm.c: Re-order bootm_load_os return check for ELDK4.2

PATCH New Tom Rini 1 participant 2 messages Jul 11, 2013 – Jul 12, 2013

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 cmd_bootm.c: Re-order bootm_load_os return check for ELDK4.2

With ELDK4.2 we were getting a warning that load_end may be used uninitialized in calling lmb_reserve. This could not be the case, however. If we re-order the checks (and make them slightly clearer as well) the warning goes away. bootm_load_os may only return 0 on success, BOOTM_ERR_OVERLAP in a non-fatal overlap (already covered in comments) or a fatal BOOTM_ERR that is covered in the error handler.

---
 common/cmd_bootm.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
common/cmd_bootm.c +2 -3
index 6caa0e9..d5b2a3c 100644
@@ -650,12 +650,11 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,
 
 		iflag = bootm_disable_interrupts();
 		ret = bootm_load_os(images, &load_end, 0);
-		if (ret && ret != BOOTM_ERR_OVERLAP)
-			goto err;
-
 		if (ret == 0)
 			lmb_reserve(&images->lmb, images->os.load,
 				    (load_end - images->os.load));
+		else if (ret && ret != BOOTM_ERR_OVERLAP)
+			goto err;
 		else if (ret == BOOTM_ERR_OVERLAP)
 			ret = 0;
 	}
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/1 cmd_bootm.c: Re-order bootm_load_os return check for ELDK4.2

Quoted 8 lines · Tom Rini

With ELDK4.2 we were getting a warning that load_end may be used uninitialized in calling lmb_reserve. This could not be the case, however. If we re-order the checks (and make them slightly clearer as well) the warning goes away. bootm_load_os may only return 0 on success, BOOTM_ERR_OVERLAP in a non-fatal overlap (already covered in comments) or a fatal BOOTM_ERR that is covered in the error handler.

Applied to u-boot/master.

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