[U-Boot] [PATCH 01/12] microblaze: board: Remove compilation warning

Michal Simek monstr at monstr.eu
Tue Jul 10 10:17:34 CEST 2012


On 07/09/2012 11:08 PM, Simon Glass wrote:
> Hi Michal,
>
> On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek <monstr at monstr.eu <mailto: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 <mailto: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 :-(

I wanted to avoid that ifdef mess. Will look at __maybe_unused. I wasn't aware about it.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian


More information about the U-Boot mailing list