[U-Boot] [PATCH] net: turn name len check into an assert
Marek Vasut
marek.vasut at gmail.com
Mon Sep 12 07:08:50 CEST 2011
On Monday, September 12, 2011 06:49:53 AM Mike Frysinger wrote:
> The new sanity check introduces a printf warning for some systems:
> eth.c:233: warning: format '%zu' expects type 'size_t', but argument 3
has
> type 'int'
>
> Rather than tweak the format string, use the new assert() helper instead.
>
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> ---
> net/eth.c | 7 +------
> 1 files changed, 1 insertions(+), 6 deletions(-)
>
> diff --git a/net/eth.c b/net/eth.c
> index 5911b1c..02baa37 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -227,12 +227,7 @@ int eth_register(struct eth_device *dev)
> {
> struct eth_device *d;
>
> - size_t len = strlen(dev->name);
> - if (len >= NAMESIZE) {
> - printf("Network driver name is too long (%zu >= %zu): %s\n",
> - len, NAMESIZE, dev->name);
> - return -1;
> - }
> + assert(strlen(dev->name) < NAMESIZE);
Aren't you changing the logic here ?
Cheers
>
> if (!eth_devices) {
> eth_current = eth_devices = dev;
More information about the U-Boot
mailing list