All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] Re: [PATCH] drivers/char: Use ARRAY_SIZE macro
Date: Thu, 17 Nov 2005 23:12:43 +0000	[thread overview]
Message-ID: <20051117151243.08b30e29.akpm@osdl.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 767 bytes --]

Tobias Klauser <tklauser@nuerscht.ch> wrote:
>
> @@ -913,15 +913,10 @@ static int stl_parsebrd(stlconf_t *confp
>  	for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
>  		*sp = TOLOWER(*sp);
>  
> -	nrbrdnames = sizeof(stl_brdstr) / sizeof(stlbrdtype_t);
> -	for (i = 0; (i < nrbrdnames); i++) {
> +	for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) {
>  		if (strcmp(stl_brdstr[i].name, argp[0]) == 0)
>  			break;
>  	}
> -	if (i >= nrbrdnames) {
> -		printk("STALLION: unknown board name, %s?\n", argp[0]);
> -		return(0);
> -	}
>  
>  	confp->brdtype = stl_brdstr[i].type;

The second change here in stallion.c seems wrong.

I replaced it with

	if (i == ARRAY_SIZE(stl_brdstr)) {
		printk("STALLION: unknown board name, %s?\n", argp[0]);
		return 0;
	}


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

             reply	other threads:[~2005-11-17 23:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 23:12 Andrew Morton [this message]
2005-11-17 23:15 ` [KJ] Re: [PATCH] drivers/char: Use ARRAY_SIZE macro Andrew Morton
2005-11-18  6:58 ` Tobias Klauser
2005-11-21 21:30 ` Christophe Lucas

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=20051117151243.08b30e29.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.