From: Dan Carpenter Date: Thu, 27 Jun 2013 23:53:45 +0000 (+1000) Subject: Documentation/CodingStyle: allow multiple return statements per function X-Git-Tag: next-20130628~3^2~131 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c22630fad21ad91efb4dd5872c8bede2a0ca05ae;p=karo-tx-linux.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 --- 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: