[PATCH 2/6] staging: dgap: fep5.c: removes smatch warning "missing break? reassigning 'ch->pscan_state'"
Dan Carpenter
dan.carpenter at oracle.com
Tue Sep 24 10:36:14 UTC 2013
On Tue, Sep 24, 2013 at 06:06:16AM -0400, Lidza Louina wrote:
> On Mon, Sep 23, 2013 at 8:10 PM, Dan Carpenter <dan.carpenter at oracle.com> wrote:
> > On Tue, Sep 24, 2013 at 03:06:06AM +0300, Dan Carpenter wrote:
> >> On Mon, Sep 23, 2013 at 06:47:13PM -0400, Lidza Louina wrote:
> >> > This patch removes this smatch warning:
> >> > warn: missing break? reassigning 'ch->pscan_state'
> >>
> >> I would just leave this one as is.
> >>
> >
> > Yes. Actually, the fix isn't right. Let's drop this one.
> >
> > regards,
> > dan carpenter
> >
>
> The switch statement this code refers to has the
> default behavior first then all the different cases. Isn't
> it supposed to be the other way around where
> the different cases are presented before the default?
Write a small test program and figure it out. ;)
int main(int argc, char **argv)
{
int num;
if (argc != 2) {
printf("no number\n");
return 1;
}
num = atoi(argv[1]);
switch (num) {
default:
printf("%d\n", num);
case 1:
printf("one\n");
break;
case 2:
printf("two\n");
}
return 0;
}
regards,
dan carpenter
More information about the devel
mailing list