Re: Checkpatch.pl generates false alarm

Joe Perches
2011-07-12T04:23:28Z

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