From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: turn name len check into an assert
Date: Mon, 12 Sep 2011 07:08:50 +0200 [thread overview]
Message-ID: <201109120708.50484.marek.vasut@gmail.com> (raw)
In-Reply-To: <1315802993-12798-1-git-send-email-vapier@gentoo.org>
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@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;
next prev parent reply other threads:[~2011-09-12 5:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-12 4:49 [U-Boot] [PATCH] net: turn name len check into an assert Mike Frysinger
2011-09-12 5:08 ` Marek Vasut [this message]
2011-09-12 16:29 ` Mike Frysinger
2011-09-12 17:06 ` Marek Vasut
2011-09-12 20:24 ` Mike Frysinger
2011-09-21 21:04 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201109120708.50484.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox