Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

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

 



On Mon, Dec 15, 2014 at 05:03:46AM -0800, Jeremiah Mahler wrote:
> 
> Or another way mentioned in K&R that produces a compile error
> 
>             if (NULL = x) 
> 

Yes.  People used to write Yoda code back in the day.  Don't ever do
this in the kernel.

1) It looks stupid.
2) GCC will catch most == vs = bugs as Alan pointed out.
3) There are still some that sneak through because people put double
   parenthesis around everything like "if ((foo = NULL) || (...)) {",
   but checkpatch.pl and Smatch will catch those.

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