From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sun, 1 May 2016 00:35:54 +0200 Subject: [U-Boot] [PATCH] cmd: disk: Fix unused variable warning Message-ID: <1462055754-6357-1-git-send-email-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de If serial support is not compiled into U-Boot, which may be the case for some SPL builds, the following warning will be generated in disk.c: cmd/disk.c: In function 'common_diskboot': cmd/disk.c:16:6: warning: variable 'dev' set but not used [-Wunused-but-set-variable] int dev, part; ^ The warning is a result of printf() calls being optimized away, and thus the whole dev variable becomes indeed unused. Mark the variable as __maybe_unused . Signed-off-by: Marek Vasut Cc: Simon Glass Cc: Tom Rini --- cmd/disk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/disk.c b/cmd/disk.c index 2fd1717..4c88554 100644 --- a/cmd/disk.c +++ b/cmd/disk.c @@ -13,7 +13,8 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc, char *const argv[]) { - int dev, part; + __maybe_unused int dev; + int part; ulong addr = CONFIG_SYS_LOAD_ADDR; ulong cnt; disk_partition_t info; -- 2.7.0