Re: [U-Boot] [PATCH 2/2] cmd: avb: Fix compiler warnings

2019-08-07 Thread Tom Rini
On Wed, Jul 31, 2019 at 07:59:09PM +0300, Sam Protsenko wrote:

> When building U-Boot with AVB enabled, compiler shows next warnings:
> 
> cmd/avb.c: In function 'do_avb_read_pvalue':
> cmd/avb.c:371:18: warning: format '%ld' expects argument of type
>   'long int', but argument 2 has type 'size_t'
>   {aka 'unsigned int'} [-Wformat=]
>printf("Read %ld bytes, value = %s\n", bytes_read,
> ~~^   ~~
> %d
> 
> cmd/avb.c: In function 'do_avb_write_pvalue':
> cmd/avb.c:404:19: warning: format '%ld' expects argument of type
>   'long int', but argument 2 has type '__kernel_size_t'
>   {aka 'unsigned int'} [-Wformat=]
>printf("Wrote %ld bytes\n", strlen(value) + 1);
>  ~~^   ~
>  %d
> 
> Fix those by using "%zu" specified.
> 
> Signed-off-by: Sam Protsenko 
> Reviewed-by: Igor Opaniuk 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] cmd: avb: Fix compiler warnings

2019-08-01 Thread Igor Opaniuk
Hi,

On Wed, Jul 31, 2019 at 7:59 PM Sam Protsenko
 wrote:
>
> When building U-Boot with AVB enabled, compiler shows next warnings:
>
> cmd/avb.c: In function 'do_avb_read_pvalue':
> cmd/avb.c:371:18: warning: format '%ld' expects argument of type
>   'long int', but argument 2 has type 'size_t'
>   {aka 'unsigned int'} [-Wformat=]
>printf("Read %ld bytes, value = %s\n", bytes_read,
> ~~^   ~~
> %d
>
> cmd/avb.c: In function 'do_avb_write_pvalue':
> cmd/avb.c:404:19: warning: format '%ld' expects argument of type
>   'long int', but argument 2 has type '__kernel_size_t'
>   {aka 'unsigned int'} [-Wformat=]
>printf("Wrote %ld bytes\n", strlen(value) + 1);
>  ~~^   ~
>  %d
>
> Fix those by using "%zu" specified.
>
> Signed-off-by: Sam Protsenko 
> ---
>  cmd/avb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/cmd/avb.c b/cmd/avb.c
> index c5af4a2e46..3f6fd763a0 100644
> --- a/cmd/avb.c
> +++ b/cmd/avb.c
> @@ -368,7 +368,7 @@ int do_avb_read_pvalue(cmd_tbl_t *cmdtp, int flag, int 
> argc,
>
> if (avb_ops->read_persistent_value(avb_ops, name, bytes, buffer,
>_read) == AVB_IO_RESULT_OK) {
> -   printf("Read %ld bytes, value = %s\n", bytes_read,
> +   printf("Read %zu bytes, value = %s\n", bytes_read,
>(char *)buffer);
> free(buffer);
> return CMD_RET_SUCCESS;
> @@ -401,7 +401,7 @@ int do_avb_write_pvalue(cmd_tbl_t *cmdtp, int flag, int 
> argc,
> if (avb_ops->write_persistent_value(avb_ops, name, strlen(value) + 1,
> (const uint8_t *)value) ==
> AVB_IO_RESULT_OK) {
> -   printf("Wrote %ld bytes\n", strlen(value) + 1);
> +   printf("Wrote %zu bytes\n", strlen(value) + 1);
> return CMD_RET_SUCCESS;
> }
>
> --
> 2.20.1
>

Reviewed-by: Igor Opaniuk 

-- 
Best regards - Freundliche GrĂ¼sse - Meilleures salutations

Igor Opaniuk

mailto: igor.opan...@gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/2] cmd: avb: Fix compiler warnings

2019-07-31 Thread Sam Protsenko
When building U-Boot with AVB enabled, compiler shows next warnings:

cmd/avb.c: In function 'do_avb_read_pvalue':
cmd/avb.c:371:18: warning: format '%ld' expects argument of type
  'long int', but argument 2 has type 'size_t'
  {aka 'unsigned int'} [-Wformat=]
   printf("Read %ld bytes, value = %s\n", bytes_read,
~~^   ~~
%d

cmd/avb.c: In function 'do_avb_write_pvalue':
cmd/avb.c:404:19: warning: format '%ld' expects argument of type
  'long int', but argument 2 has type '__kernel_size_t'
  {aka 'unsigned int'} [-Wformat=]
   printf("Wrote %ld bytes\n", strlen(value) + 1);
 ~~^   ~
 %d

Fix those by using "%zu" specified.

Signed-off-by: Sam Protsenko 
---
 cmd/avb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/avb.c b/cmd/avb.c
index c5af4a2e46..3f6fd763a0 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -368,7 +368,7 @@ int do_avb_read_pvalue(cmd_tbl_t *cmdtp, int flag, int argc,
 
if (avb_ops->read_persistent_value(avb_ops, name, bytes, buffer,
   _read) == AVB_IO_RESULT_OK) {
-   printf("Read %ld bytes, value = %s\n", bytes_read,
+   printf("Read %zu bytes, value = %s\n", bytes_read,
   (char *)buffer);
free(buffer);
return CMD_RET_SUCCESS;
@@ -401,7 +401,7 @@ int do_avb_write_pvalue(cmd_tbl_t *cmdtp, int flag, int 
argc,
if (avb_ops->write_persistent_value(avb_ops, name, strlen(value) + 1,
(const uint8_t *)value) ==
AVB_IO_RESULT_OK) {
-   printf("Wrote %ld bytes\n", strlen(value) + 1);
+   printf("Wrote %zu bytes\n", strlen(value) + 1);
return CMD_RET_SUCCESS;
}
 
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot