Patchwork [U-Boot,v6,5/5] remove compiling warnings

login
register
mail settings
Submitter fenghua@phytium.com.cn
Date Sept. 9, 2013, 1:50 p.m.
Message ID <1378734616-37558-6-git-send-email-fenghua@phytium.com.cn>
Download mbox | patch
Permalink /patch/273576/
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Comments

fenghua@phytium.com.cn - Sept. 9, 2013, 1:50 p.m.
From: David Feng <fenghua@phytium.com.cn>

Signed-off-by: David Feng <fenghua@phytium.com.cn>
---
 common/cmd_pxe.c |    4 ++--
 lib/hashtable.c  |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
Wolfgang Denk - Sept. 9, 2013, 2:22 p.m.
Dear fenghua@phytium.com.cn,

In message <1378734616-37558-6-git-send-email-fenghua@phytium.com.cn> you wrote:
> From: David Feng <fenghua@phytium.com.cn>
> 
> Signed-off-by: David Feng <fenghua@phytium.com.cn>
> ---
>  common/cmd_pxe.c |    4 ++--
>  lib/hashtable.c  |    1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
> index a2fb50a..52375a4 100644
> --- a/common/cmd_pxe.c
> +++ b/common/cmd_pxe.c
> @@ -57,7 +57,7 @@ static int format_mac_pxe(char *outbuf, size_t outbuf_len)
>  	uchar ethaddr[6];
>  
>  	if (outbuf_len < 21) {
> -		printf("outbuf is too small (%d < 21)\n", outbuf_len);
> +		printf("outbuf is too small (%ld < 21)\n", outbuf_len);

This does not look right to me.  outbuf_len is of type "size_t", which
may or may not be the same as "long".

You should use "%z" here.

>  		return -EINVAL;
>  	}
> @@ -100,7 +100,7 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,
>  	path_len = (last_slash - bootfile) + 1;
>  
>  	if (bootfile_path_size < path_len) {
> -		printf("bootfile_path too small. (%d < %d)\n",
> +		printf("bootfile_path too small. (%ld < %ld)\n",

Ditto.

> --- a/lib/hashtable.c
> +++ b/lib/hashtable.c
> @@ -13,6 +13,7 @@
>   * SPDX-License-Identifier:	LGPL-2.1+
>   */
>  
> +#include <config.h>
>  #include <errno.h>
>  #include <malloc.h>

Why would that be needed?

Best regards,

Wolfgang Denk

Patch

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index a2fb50a..52375a4 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -57,7 +57,7 @@  static int format_mac_pxe(char *outbuf, size_t outbuf_len)
 	uchar ethaddr[6];
 
 	if (outbuf_len < 21) {
-		printf("outbuf is too small (%d < 21)\n", outbuf_len);
+		printf("outbuf is too small (%ld < 21)\n", outbuf_len);
 
 		return -EINVAL;
 	}
@@ -100,7 +100,7 @@  static int get_bootfile_path(const char *file_path, char *bootfile_path,
 	path_len = (last_slash - bootfile) + 1;
 
 	if (bootfile_path_size < path_len) {
-		printf("bootfile_path too small. (%d < %d)\n",
+		printf("bootfile_path too small. (%ld < %ld)\n",
 				bootfile_path_size, path_len);
 
 		return -1;
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 644330a..ec53794 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -13,6 +13,7 @@ 
  * SPDX-License-Identifier:	LGPL-2.1+
  */
 
+#include <config.h>
 #include <errno.h>
 #include <malloc.h>