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

* [KJ] Re: [PATCH] drivers/char: Use ARRAY_SIZE macro
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2005-11-17 23:15 UTC (permalink / raw)
  To: kernel-janitors

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

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

Same problem here.

	if (i == ARRAY_SIZE(stli_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

* [KJ] Re: [PATCH] drivers/char: Use ARRAY_SIZE macro
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Tobias Klauser @ 2005-11-18  6:58 UTC (permalink / raw)
  To: kernel-janitors

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

On 2005-11-18 at 00:12:43 +0100, Andrew Morton <akpm@osdl.org> wrote:
> 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;
> 	}

Oh sure! Don't know what hit me there. :-/ Thanks for correcting.

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

* Re: [KJ] Re: [PATCH] drivers/char: Use ARRAY_SIZE macro
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Christophe Lucas @ 2005-11-21 21:30 UTC (permalink / raw)
  To: kernel-janitors

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

Andrew Morton (akpm@osdl.org) wrote:
> 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;
> 	}
 
Should correct KERN_* constant be used here in printk(); ? 

				- Christophe (clucas@rotomalug.org)


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