소스 검색

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.

Signed-off-by: Tom Rini <trini@ti.com>
Tom Rini 11 년 전
부모
커밋
970150a167
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      common/cmd_bootm.c

+ 2 - 3
common/cmd_bootm.c

@@ -650,12 +650,11 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,
 
 
 		iflag = bootm_disable_interrupts();
 		iflag = bootm_disable_interrupts();
 		ret = bootm_load_os(images, &load_end, 0);
 		ret = bootm_load_os(images, &load_end, 0);
-		if (ret && ret != BOOTM_ERR_OVERLAP)
-			goto err;
-
 		if (ret == 0)
 		if (ret == 0)
 			lmb_reserve(&images->lmb, images->os.load,
 			lmb_reserve(&images->lmb, images->os.load,
 				    (load_end - images->os.load));
 				    (load_end - images->os.load));
+		else if (ret && ret != BOOTM_ERR_OVERLAP)
+			goto err;
 		else if (ret == BOOTM_ERR_OVERLAP)
 		else if (ret == BOOTM_ERR_OVERLAP)
 			ret = 0;
 			ret = 0;
 	}
 	}