mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch: don't complain on module_param(foo, bar, 0)
@ 2017-02-09  0:05 Brian Norris
  2017-02-23 22:10 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2017-02-09  0:05 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: linux-kernel, Brian Norris

The following code snippet:

    module_param(writeable, bool, 0);

yields this warning:

    ERROR: Use 4 digit octal (0777) not decimal permissions
    #390: FILE: drivers/mtd/spi-nor/intel-spi.c:143:
    +module_param(writeable, bool, 0);
    total: 1 errors, 0 warnings, 1006 lines checked

But 0000 is no easier to read than 0, and module_param() even
specifically refers to 0.

You can, for instance, test the patch:

    [PATCH v6 1/3] spi-nor: Add support for Intel SPI serial flash controller

like this:

    $ wget -qO - https://patchwork.ozlabs.org/patch/699946/mbox/ | scripts/checkpatch.pl -

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 scripts/checkpatch.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 982c52ca6473..ada28aad8d64 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6138,6 +6138,10 @@ sub process {
 				if ($stat =~ /$test/) {
 					my $val = $1;
 					$val = $6 if ($skip_args ne "");
+					# '0' is valid; some APIs special-case
+					# '0' as "no sysfs" node, and it's no
+					# harder to read than '0000'.
+					next if ($val eq "0");
 					if (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
 					    ($val =~ /^$Octal$/ && length($val) ne 4)) {
 						ERROR("NON_OCTAL_PERMISSIONS",
-- 
2.11.0.483.g087da7b7c-goog

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

end of thread, other threads:[~2017-02-23 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-09  0:05 [PATCH] checkpatch: don't complain on module_param(foo, bar, 0) Brian Norris
2017-02-23 22:10 ` Andy Shevchenko
2017-02-23 22:20   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®