Instead of an error, lower to a warning message, assuming the comment
gives some justification.

Discussed in:
'[Qemu-devel] [PATCH] dump-guest-memory.py: fix "You can't do that without a 
process to debug"'

Suggested-by: Fam Zheng <f...@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
---
 scripts/checkpatch.pl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 34df753571..f5a523af10 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2476,7 +2476,12 @@ sub process {
 # no volatiles please
                my $asm_volatile = 
qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
                if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
-                       ERROR("Use of volatile is usually wrong: see 
Documentation/volatile-considered-harmful.txt\n" . $herecurr);
+                       my $msg = "Use of volatile is usually wrong: see 
Documentation/volatile-considered-harmful.txt\n" . $herecurr;
+                       if (ctx_has_comment($first_line, $linenr)) {
+                               WARN($msg);
+                       } else {
+                               ERROR($msg);
+                       }
                }
 
 # warn about #if 0
-- 
2.15.1.355.g36791d7216


Reply via email to