Messages in this thread Patch in this message | | | From | Brian Norris <> | Subject | [PATCH] checkpatch: don't complain on module_param(foo, bar, 0) | Date | Wed, 8 Feb 2017 16:05:01 -0800 |
| |
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
| |