]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Documentation/CodingStyle: allow multiple return statements per function
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 7 Jun 2013 00:09:33 +0000 (10:09 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 17 Jun 2013 08:20:11 +0000 (18:20 +1000)
A surprising number of newbies interpret this section to mean that only
one return statement is allowed per function.  Part of the problem is that
the "one return statement per function" rule is an actual style guideline
that people are used to from other projects.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Documentation/CodingStyle

index e00b8f0dde52e520d5bcc378aa0bbf4f506a6b23..7fe0546c504afdefc4be2f71279df7c377c03b46 100644 (file)
@@ -389,7 +389,8 @@ Albeit deprecated by some people, the equivalent of the goto statement is
 used frequently by compilers in form of the unconditional jump instruction.
 
 The goto statement comes in handy when a function exits from multiple
-locations and some common work such as cleanup has to be done.
+locations and some common work such as cleanup has to be done.  If there is no
+cleanup needed then just return directly.
 
 The rationale is: