diff mbox

[U-Boot,09/10] board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

Message ID 20170607162847.16971-10-sjg@chromium.org
State Accepted
Commit baa7d345fb2a7aaee31af6d77f2a790e89864af6
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass June 7, 2017, 4:28 p.m. UTC
The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)
---

 common/board_f.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Tom Rini June 12, 2017, 10:43 p.m. UTC | #1
On Wed, Jun 07, 2017 at 10:28:46AM -0600, Simon Glass wrote:

> The current implementation makes it look like the 'if (from_spl)' part is
> dead code because these features are not enabled for sandbox. We could
> enable it for sandbox_spl, but this is not done yet (it requires sharing
> memory between SPL and U-Boot proper which is in fact supported).
> 
> It is probably nicer to avoid #ifdef anyway. Change it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reported-by: Coverity (CID: 163244)
> Fixes: 824bb1b (bootstage: Support SPL)

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 46e52849fb..d8d15ad115 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -707,11 +707,8 @@  static int jump_to_copy(void)
 /* Record the board_init_f() bootstage (after arch_cpu_init()) */
 static int initf_bootstage(void)
 {
-#if defined(CONFIG_SPL_BOOTSTAGE) && defined(CONFIG_BOOTSTAGE_STASH)
-	bool from_spl = true;
-#else
-	bool from_spl = false;
-#endif
+	bool from_spl = IS_ENABLED(CONFIG_SPL_BOOTSTAGE) &&
+			IS_ENABLED(CONFIG_BOOTSTAGE_STASH);
 	int ret;
 
 	ret = bootstage_init(!from_spl);