cmd: disk: Fix unused variable warning
PATCH 1/1 cmd: disk: Fix unused variable warning
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 .
--- cmd/disk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/disk.c +2 -1
@@ -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;
Signature · 1 line
2.7.0
PATCH 1/1 cmd: disk: Fix unused variable warning
Quoted 11 lines · Marek Vasut
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.
Quoted 6 lines
Signed-off-by Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>Cc Tom Rini <[email protected]>--- cmd/disk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH 1/1 cmd: disk: Fix unused variable warning
In reply to Marek VasutQuoted 7 lines · Marek Vasut
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; ^
Quoted 7 lines
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 <[email protected]>Cc Simon Glass <[email protected]>Cc Tom Rini <[email protected]>
Signature · 8 lines
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>
Quoted 11 lines · Marek Vasut
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.
Quoted 5 lines
Signed-off-by Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>Cc Tom Rini <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>