Re: [PATCH 06/22] Staging: bcm: PHSModule.c: Reduced indentation level by using jump label

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

 



On Tue, Jul 15, 2014 at 09:42:59AM +0200, Matthias Beyer wrote:

> +
> +out:
>  	return 0;

Don't do these do-nothing gotos.  Just return directly.

When you are reading the code and you see a goto then you have to think
"Oh, I wonder what the goto does?"  If has a good name like
"err_free_foo" then you probably can guess that it frees "foo".  If it
says "goto out" then you probably assume it releases a lock or something
but which lock??  So then you have to jump to the bottom of the screen
to find out.

Once you read the bottom of the screen, you see that it is a pointless
waste of time goto which doesn't do anything at all.  And now you have
lost your place in the code and your train of thought has been de-railed
so you have to figure out where you were and what you were doing before
you started on this wild goose chase.

Don't do that.

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