From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Tue, 10 Jul 2012 10:17:34 +0200 Subject: [U-Boot] [PATCH 01/12] microblaze: board: Remove compilation warning In-Reply-To: References: <1341825639-23475-1-git-send-email-monstr@monstr.eu> Message-ID: <4FFBE51E.6050408@monstr.eu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 07/09/2012 11:08 PM, Simon Glass wrote: > Hi Michal, > > On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek > 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 > > --- > 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