Skip to contentSkip to conversation

checkpatch: fix UNNECESSARY_KERN_LEVEL false positive

PATCH In review Paolo Bonzini 2 participants 2 messages Dec 23, 2014 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 checkpatch: fix UNNECESSARY_KERN_LEVEL false positive

KERN_<LEVEL> is never redundant with printk_ratelimited or printk_once. (Except perhaps in the sense that you could use e.g. pr_err_ratelimited or pr_err_once, but that would apply to printk as well).

Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
Cc Andrew Morton <[email protected]>

---

	v1->v2: skip printk_once too [Joe Perches]
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index f0bb6d60c07b..350cd692a138 100755
@@ -4545,7 +4545,7 @@ sub process {
 		}
 
 # check for logging functions with KERN_<LEVEL>
-		if ($line !~ /printk\s*\(/ &&
+		if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ &&
 		    $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
 			my $level = $1;
 			if (WARN("UNNECESSARY_KERN_LEVEL",
Signature · 1 line
1.8.3.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 3 lines · Paolo Bonzini

KERN_<LEVEL> is never redundant with printk_ratelimited or printk_once. (Except perhaps in the sense that you could use e.g. pr_err_ratelimited or pr_err_once, but that would apply to printk as well).

[]

Quoted 1 line
	v1->v2: skip printk_once too [Joe Perches]

Thanks,