[U-Boot] [PATCH 01/12] microblaze: board: Remove compilation warning
Simon Glass
sjg at chromium.org
Mon Jul 9 23:08:20 CEST 2012
Hi Michal,
On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek <monstr at monstr.eu> wrote:
> Variable is used when CONFIG_SYS_FLASH_CHECKSUM is used.
>
> Warning log:
> board.c: In function 'board_init':
> board.c:101: warning: unused variable 's'
>
> Signed-off-by: Michal Simek <monstr at monstr.eu>
> ---
> arch/microblaze/lib/board.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index a8ed7ce..4146f5c 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -98,7 +98,6 @@ void board_init (void)
> gd = (gd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET);
> bd = (bd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \
> - GENERATED_BD_INFO_SIZE);
> - char *s;
> #if defined(CONFIG_CMD_FLASH)
> ulong flash_size = 0;
> #endif
> @@ -157,9 +156,9 @@ void board_init (void)
> puts ("Flash: ");
> bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
> if (0 < (flash_size = flash_init ())) {
> - bd->bi_flashsize = flash_size;
> - bd->bi_flashoffset = CONFIG_SYS_FLASH_BASE + flash_size;
> # ifdef CONFIG_SYS_FLASH_CHECKSUM
> + char *s;
> +
>
Is it a good idea to put declarations in the middle of the code? I don't
think that is U-Boot style.
You could instead use __maybe_unused on the variable, or #ifdef the
declaration :-(
> print_size (flash_size, "");
> /*
> * Compute and print flash CRC if flashchecksum is set to
> 'y'
> @@ -176,6 +175,8 @@ void board_init (void)
> # else /* !CONFIG_SYS_FLASH_CHECKSUM */
> print_size (flash_size, "\n");
> # endif /* CONFIG_SYS_FLASH_CHECKSUM */
> + bd->bi_flashsize = flash_size;
> + bd->bi_flashoffset = CONFIG_SYS_FLASH_BASE + flash_size;
> } else {
> puts ("Flash init FAILED");
> bd->bi_flashstart = 0;
> --
> 1.7.0.4
>
> Regards,
Simon
More information about the U-Boot
mailing list