Re: [PATCH] Staging: wlan-ng: hfa384x_usb: fixed an 'else' statement coding style issue

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

 



On Mon, 2014-12-15 at 18:53 -0200, Eduardo Barretto wrote:
> Thank you for the quick feedback. 
> It was my first patch to the kernel and I wanted to be sure it would get right to the community.
> I'll be making a version two with the consideration you brought me.

the code today is:

{
	switch (prdcode) {
	case [...]
		return 1;
	default:
		if (prdcode < 0x1000) {
			printk(msg1);
			return 1;
		else
			printk(msg2);
			return 0;
	}
	return 0;	/* avoid compiler noise */
}

I think this code does not needs changing.
I think more modern compilers don't even warn
when the last return 0; isn't there.

If it were to be changed, I'd probably write it like:

{
	switch (prdcode) {
	case [...]
		return 1;
	default:
		if (prdcode < 0x1000) {
			printk(msg1);
			return 1;
		}
		break;
	}

	printk(msg2);
	return 0;
}

but I wouldn't bother.

_______________________________________________
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