U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: disk: Fix unused variable warning
@ 2016-04-30 22:35 Marek Vasut
  2016-05-01 18:55 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Vasut @ 2016-04-30 22:35 UTC (permalink / raw)
  To: u-boot

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 <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] cmd: disk: Fix unused variable warning
  2016-04-30 22:35 [U-Boot] [PATCH] cmd: disk: Fix unused variable warning Marek Vasut
@ 2016-05-01 18:55 ` Simon Glass
  2016-05-02 23:31 ` Tom Rini
  2016-05-30 17:56 ` [U-Boot] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2016-05-01 18:55 UTC (permalink / raw)
  To: u-boot

On 30 April 2016 at 16:35, Marek Vasut <marex@denx.de> wrote:
> 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 <marex@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>  cmd/disk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] cmd: disk: Fix unused variable warning
  2016-04-30 22:35 [U-Boot] [PATCH] cmd: disk: Fix unused variable warning Marek Vasut
  2016-05-01 18:55 ` Simon Glass
@ 2016-05-02 23:31 ` Tom Rini
  2016-05-30 17:56 ` [U-Boot] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-05-02 23:31 UTC (permalink / raw)
  To: u-boot

On Sun, May 01, 2016 at 12:35:54AM +0200, Marek Vasut wrote:

> 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 <marex@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160502/1214ec1a/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] cmd: disk: Fix unused variable warning
  2016-04-30 22:35 [U-Boot] [PATCH] cmd: disk: Fix unused variable warning Marek Vasut
  2016-05-01 18:55 ` Simon Glass
  2016-05-02 23:31 ` Tom Rini
@ 2016-05-30 17:56 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-05-30 17:56 UTC (permalink / raw)
  To: u-boot

On Sun, May 01, 2016 at 12:35:54AM +0200, Marek Vasut wrote:

> 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 <marex@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/fbc3c74c/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-30 17:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-30 22:35 [U-Boot] [PATCH] cmd: disk: Fix unused variable warning Marek Vasut
2016-05-01 18:55 ` Simon Glass
2016-05-02 23:31 ` Tom Rini
2016-05-30 17:56 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox