From: Dan Carpenter Date: Wed, 3 Jul 2013 22:08:08 +0000 (-0700) Subject: Documentation/CodingStyle: allow multiple return statements per function X-Git-Tag: MMI-PSA29.97-13-9~14093^2~61 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b57a0505e750b3d7b2d39e9823b276d8ca1a08fe;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git Documentation/CodingStyle: allow multiple return statements per function 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 Cc: Eduardo Valentin Cc: Rob Landley Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index e00b8f0dde52..7fe0546c504a 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle @@ -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: