From a59a87ca17ff6fd2933c26043e78ac9e4fb3fa5d Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Wed, 13 Jul 2022 16:36:25 +0200 Subject: [PATCH] lint/checkpatch: Update 'check indentation of a line with a break' This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas Change-Id: I79170a45cd8184ebc816b4f16656a3cfdc257f60 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65828 Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth --- util/lint/checkpatch.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index f41f6ab244..577bdfa1a2 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -3636,9 +3636,12 @@ sub process { # and is indented the same # of tabs if ($sline =~ /^\+([\t]+)break\s*;\s*$/) { my $tabs = $1; - if ($prevline =~ /^\+$tabs(?:goto|return|break)\b/) { - WARN("UNNECESSARY_BREAK", - "break is not useful after a $1\n" . $hereprev); + if ($prevline =~ /^\+$tabs(goto|return|break)\b/) { + if (WARN("UNNECESSARY_BREAK", + "break is not useful after a $1\n" . $hereprev) && + $fix) { + fix_delete_line($fixlinenr, $rawline); + } } }