All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] Re: [PATCH] drivers/char: Use ARRAY_SIZE macro
@ 2005-11-17 23:12 Andrew Morton
  2005-11-17 23:15 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Morton @ 2005-11-17 23:12 UTC (permalink / raw)
  To: kernel-janitors

[-- 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-21 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-17 23:12 [KJ] Re: [PATCH] drivers/char: Use ARRAY_SIZE macro Andrew Morton
2005-11-17 23:15 ` Andrew Morton
2005-11-18  6:58 ` Tobias Klauser
2005-11-21 21:30 ` Christophe Lucas

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.