Re: Checkpatch.pl generates false alarm
From: Andy Whitcroft
Date: Tue Jul 12 2011 - 04:03:42 EST
On Mon, Jul 11, 2011 at 09:23:26PM -0700, Joe Perches wrote:
> On Mon, 2011-07-11 at 16:48 +0200, Roland Vossen wrote:
> > Hello Andy,
> >
> > when I feed attached file to checkpatch, several warnings are given, but
> > this one:
> >
> > WARNING: externs should be avoided in .c files
> > #3555: FILE: staging/brcm80211/brcmsmac/main.c:3555:
> > + END_FOREACH_BSS
> >
> > does not seem to make sense. When I place a comment behind the
> > END_FOREACH_BSS line, the checkpatch warning disappears.
> >
> > Let me know if you need additional info to work on this.
>
> I think this code is bad form and confuses checkpatch:
>
> /* update the capability based on current shortslot mode */
> FOREACH_BSS(wlc, idx, cfg)
> if (!cfg->associated)
> continue;
> cfg->current_bss->capability &=
> ~WLAN_CAPABILITY_SHORT_SLOT_TIME;
> if (wlc->shortslot)
> cfg->current_bss->capability |=
> WLAN_CAPABILITY_SHORT_SLOT_TIME;
> END_FOREACH_BSS
>
> I think this code is still slightly bad form, but it isn't a problem
> for checkpatch:
>
> /* update the capability based on current shortslot mode */
> FOREACH_BSS(wlc, idx, cfg) {
> if (!cfg->associated)
> continue;
> cfg->current_bss->capability &=
> ~WLAN_CAPABILITY_SHORT_SLOT_TIME;
> if (wlc->shortslot)
> cfg->current_bss->capability |=
> WLAN_CAPABILITY_SHORT_SLOT_TIME;
> } END_FOREACH_BSS
Yeah I can only concur that this is the more normal form for such fake
loop structures which needs begins and ends. I don't think we are going
to be able to trivially figure out this is a loop otherwise.
-apw
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/