[PATCH 1/2] tools: env: Fix printf() warning in fw_env

The printf() string produces a warning about %d not matching size_t. Fix it and put the format string on one line to avoid a checkpatch warning.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/env/fw_env.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 3ab1ae69c7a..ccbeb5552bc 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -952,8 +952,8 @@ static int flash_read_buf(int dev, int fd, void *buf, size_t count, return -1; } if (rc != readlen) { - fprintf(stderr, "Read error on %s: " - "Attempted to read %d bytes but got %d\n", + fprintf(stderr, + "Read error on %s: Attempted to read %zd bytes but got %d\n", DEVNAME(dev), readlen, rc); return -1; }

Set this variable to 0 to avoid a warning about an unused variable. This happens on gcc 7.5.0 for me.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/env/fw_env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index ccbeb5552bc..66cb9d2a25e 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -995,7 +995,7 @@ static int flash_write_buf(int dev, int fd, void *buf, size_t count) of the data */ loff_t blockstart; /* running start of the current block - MEMGETBADBLOCK needs 64 bits */ - int was_locked; /* flash lock flag */ + int was_locked = 0; /* flash lock flag */ int rc;
/*

On Sat, Aug 01, 2020 at 10:30:39AM -0600, Simon Glass wrote:
Set this variable to 0 to avoid a warning about an unused variable. This happens on gcc 7.5.0 for me.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

On Sat, Aug 01, 2020 at 10:30:38AM -0600, Simon Glass wrote:
The printf() string produces a warning about %d not matching size_t. Fix it and put the format string on one line to avoid a checkpatch warning.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!
participants (2)
-
Simon Glass
-
Tom Rini