Re: [PATCH 2/6] staging: dgap: fep5.c: removes smatch warning "missing break? reassigning 'ch->pscan_state'"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux