From: Heinrich Schuchardt Date: Fri, 17 Nov 2017 23:28:38 +0000 (-0800) Subject: scripts/checkpatch.pl: avoid false warning missing break X-Git-Tag: v5.15~9955^2~53 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=258f79d5a1e49271f5aff38e6c1baeeaad0d82aa;p=mirror_ubuntu-kernels.git scripts/checkpatch.pl: avoid false warning missing break void foo(int a) switch (a) { case 'h': fun1(); exit(1); default: } creates a warning "Possible switch case/default not preceded by break or fallthrough comment". exit( should be treated like return. Link: http://lkml.kernel.org/r/20170910154618.25819-1-xypron.glpk@gmx.de Signed-off-by: Heinrich Schuchardt Acked-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index aacbe918027b..8dce8a8d9ed0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6109,7 +6109,7 @@ sub process { next if ($fline =~ /^.[\s$;]*$/); $has_statement = 1; $count++; - $has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|return\b|goto\b|continue\b)/); + $has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|exit\s*\(\b|return\b|goto\b|continue\b)/); } if (!$has_break && $has_statement) { WARN("MISSING_BREAK",