checkpatch: Don't warn about if ((status = _xbegin()) == _XBEGIN_STARTED) Writing _xbegin which is like setjmp in a if is very natural. Stop checkpatch's whining about this. Cc: apw@canonical.com Signed-off-by: Andi Kleen <ak@linux.intel.com>
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b954de5..21a6d62 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl
@@ -2840,7 +2840,10 @@ $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) { my ($s, $c) = ($stat, $cond); - if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) { + # if ((status = _xbegin()) == _XBEGIN_STARTED) is natural, + # so don't warn about this case. + if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s && + $c !~ /_xbegin/) { ERROR("ASSIGN_IN_IF", "do not use assignment in if condition\n" . $herecurr); }