Re: [RFC] staging/vSMP: new driver

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

 



On Thu, Mar 17, 2022 at 01:19:43PM +0300, Dan Carpenter wrote:
> "new driver" is too vague.  What is the driver for?
> 
> You need a README or a TODO which explains how to move the driver out of
> staging and into the main kernel.
> 
> Run the patch through scripts/checkpatch.pl --strict.  You don't have
> to fix everything because this is staging but a bunch of the style
> issues are easy to fix so we may as well just do it.
> 
> There are a number of bugs and style issues.
> 1) Find and replace every -1 with a define or a proper error code
> 2) Never do assignments inside of a condition
> 3) Do success handling instead of error handling.  Try to return errors

I meant the other way around.  Do error handling.  If you return an
error directly then code looks like this:

	success;
	if (fail)
		cleanup;
	success;
	success;
	if (fail)
		more cleanup;

Otherwise if you have two successes then it starts getting indented a
lot.

	success;
	if (success)
		success;
		success;
		if (success)
			success;
		else
			more cleanup;
	else
		cleanup;

Pasta.

regards,
dan carpenter





[Index of Archives]     [Linux Driver Development]     [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