]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
checkpatch: dont warn about unused macro arg on empty body
authorJim Cromie <jim.cromie@gmail.com>
Tue, 25 Mar 2025 23:51:54 +0000 (17:51 -0600)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:54:05 +0000 (17:54 -0700)
Patch series "2 checkpatch fixes, one pr_info_once".

2 small tweaks to checkpatch,
1 reducing several pages of powernow "not-relevant-here" log-msgs to a few lines

This patch (of 3):

We currently get:
  WARNING: Argument 'name' is not used in function-like macro
on:
  #define DRM_CLASSMAP_USE(name)  /* nothing here */

Following this advice is wrong here, and shouldn't be fixed by ignoring
args altogether; the macro should properly fail if invoked with 0 or 2+
args.

Link: https://lkml.kernel.org/r/20250325235156.663269-1-jim.cromie@gmail.com
Link: https://lkml.kernel.org/r/20250325235156.663269-2-jim.cromie@gmail.com
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Joe Perches <joe@perches.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc:"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/checkpatch.pl

index 3d22bf863eec9edf0c2fe7ad7a8986d7e8ad892a..75349f766b89d19b519a90be8659517f5ee960dc 100755 (executable)
@@ -6024,7 +6024,7 @@ sub process {
                                }
 
 # check if this is an unused argument
-                               if ($define_stmt !~ /\b$arg\b/) {
+                               if ($define_stmt !~ /\b$arg\b/ && $define_stmt) {
                                        WARN("MACRO_ARG_UNUSED",
                                             "Argument '$arg' is not used in function-like macro\n" . "$herectx");
                                }