Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Dan Carpenter and committed by
Linus Torvalds
b57a0505 e68e96d2

+2 -1
+2 -1
Documentation/CodingStyle
··· 389 389 used frequently by compilers in form of the unconditional jump instruction. 390 390 391 391 The goto statement comes in handy when a function exits from multiple 392 - locations and some common work such as cleanup has to be done. 392 + locations and some common work such as cleanup has to be done. If there is no 393 + cleanup needed then just return directly. 393 394 394 395 The rationale is: 395 396