[U-Boot] [PATCH] cmd: disk: Fix unused variable warning

Simon Glass sjg at chromium.org
Sun May 1 20:55:22 CEST 2016


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

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


More information about the U-Boot mailing list