Skip to content

Commit

Permalink
board: sifive: Fix a potential build warning in board_fdt_blob_setup()
Browse files Browse the repository at this point in the history
Commit 47d73ba ("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 <[email protected]>
Reviewed-by: Leo Yu-Chi Liang <[email protected]>
Reviewed-by: Rick Chen <[email protected]>
  • Loading branch information
lbmeng authored and Leo Yu-Chi Liang committed Oct 20, 2021
1 parent fb10181 commit a0cfe13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions board/sifive/unleashed/unleashed.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions board/sifive/unmatched/unmatched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a0cfe13

Please sign in to comment.