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
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to