Re: Checkpatch.pl generates false alarm

From: Joe Perches
Date: Tue Jul 12 2011 - 00:23:32 EST


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


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