Re: [BUG] checkpatch warning default switch case

From: Joe Perches
Date: Fri Dec 11 2015 - 15:08:40 EST


On Fri, 2015-12-11 at 16:34 -0300, Geyslan G. Bem wrote:
> Hello,
>
> Running
> scripts/checkpatch.pl -f drivers/usb/host/ehci-sched.c
>
> I got this
> ...
> ERROR: spaces required around that ':' (ctx:VxE)
> #496: FILE: drivers/usb/host/ehci-sched.c:496:
> +                       default:
> ...
>
>
> 496:            default:
>                         ehci_dbg (ehci,
>                                 "periodic frame %d bogus type %d\n",
>                                 frame, type);
>                 }
>
> It seems a correct use of default switch case. Maybe the test concerns
> to ternary conditional.
>
> Let me know.

Yes, it's a checkpatch defect.

It's because a c99 style comment is immediately before this line.

switch (foo) {
case 1:
break;
// foo
default:
break;
}

emits this ERROR

I suggest you fix the comment and the message will go away.

Andy?  Do you care to fix this defect?

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