linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: don't warn on every struct without const_structs file
@ 2017-01-10 14:03 Johannes Berg
  2017-01-10 15:01 ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2017-01-10 14:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Joe Perches, linux-kernel, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

The script says that it won't warn:
"No structs that should be const will be found [...]"

but then that doesn't work and it warns on every single struct
instead, since the regular expression ends up empty. Fix that
by checking that it's not empty first.

Fixes: bf1fa1dae68e ("checkpatch: externalize the structs that should be const")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a8368d1c4348..722a319acec5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6010,7 +6010,8 @@ sub process {
 		}
 
 # check for various structs that are normally const (ops, kgdb, device_tree)
-		if ($line !~ /\bconst\b/ &&
+		if ($const_structs ne "" &&
+		    $line !~ /\bconst\b/ &&
 		    $line =~ /\bstruct\s+($const_structs)\b/) {
 			WARN("CONST_STRUCT",
 			     "struct $1 should normally be const\n" .
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-10 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 14:03 [PATCH] checkpatch: don't warn on every struct without const_structs file Johannes Berg
2017-01-10 15:01 ` Joe Perches
2017-01-10 15:04   ` Johannes Berg
2017-01-10 16:27     ` Joe Perches
2017-01-10 16:31       ` Johannes Berg
2017-01-10 16:50         ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).