u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] board: sifive: Fix a potential build warning in board_fdt_blob_setup()
@ 2021-09-11 14:31 Bin Meng
  2021-09-14  8:21 ` Leo Liang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bin Meng @ 2021-09-11 14:31 UTC (permalink / raw)
  To: Zong Li, Leo Yu-Chi Liang, Rick Chen, u-boot

Commit 47d73ba4f4a4 ("board: sifive: overwrite board_fdt_blob_setup in u-boot proper")
added a board-specific implementation of board_fdt_blob_setup() which
takes a pointer as the return value, but it does not return anything
if CONFIG_OF_SEPARATE is not enabled. This will cause a build warning
seen when testing booting S-mode U-Boot directly from QEMU, per the
instructions in [1]:

  board/sifive/unleashed/unleashed.c: In function ‘board_fdt_blob_setup’:
  board/sifive/unleashed/unleashed.c:125:1: warning: control reaches end of non-void function [-Wreturn-type]

Return &_end as the default case.

[1] https://qemu.readthedocs.io/en/latest/system/riscv/sifive_u.html#running-u-boot

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

Changes in v2:
- Correct the commit title

 board/sifive/unleashed/unleashed.c | 4 ++--
 board/sifive/unmatched/unmatched.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c
index 8cd514df30..33baeda986 100644
--- a/board/sifive/unleashed/unleashed.c
+++ b/board/sifive/unleashed/unleashed.c
@@ -119,9 +119,9 @@ void *board_fdt_blob_setup(void)
 	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
 		if (gd->arch.firmware_fdt_addr)
 			return (ulong *)gd->arch.firmware_fdt_addr;
-		else
-			return (ulong *)&_end;
 	}
+
+	return (ulong *)&_end;
 }
 
 int board_init(void)
diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
index d90b252bae..8773b660fa 100644
--- a/board/sifive/unmatched/unmatched.c
+++ b/board/sifive/unmatched/unmatched.c
@@ -16,9 +16,9 @@ void *board_fdt_blob_setup(void)
 	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
 		if (gd->arch.firmware_fdt_addr)
 			return (ulong *)gd->arch.firmware_fdt_addr;
-		else
-			return (ulong *)&_end;
 	}
+
+	return (ulong *)&_end;
 }
 
 int board_init(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-11  3:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-11 14:31 [PATCH v2] board: sifive: Fix a potential build warning in board_fdt_blob_setup() Bin Meng
2021-09-14  8:21 ` Leo Liang
     [not found] ` <HK0PR03MB299484FCB8C64939BB8F91E6C1DD9@HK0PR03MB2994.apcprd03.prod.outlook.com>
2021-09-17  6:52   ` Rick Chen
2021-10-11  3:13     ` Bin Meng
2021-09-29 13:07 ` Ilias Apalodimas
2021-09-29 14:03   ` Bin Meng
2021-09-29 14:59     ` Ilias Apalodimas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).