Skip to contentSkip to conversation

checkpatch: don't require octal permissions for "0" in module_param

PATCH In review Bartosz Golaszewski 1 participant 2 messages Dec 11, 2017 – Dec 13, 2017 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: don't require octal permissions for "0" in module_param

File permissions set to "0" in the module_param family of macros mean that the parameter should not show up in sysfs. Don't require octal permissions in this case.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 040aa79e1d9d..32c37f8bc143 100755
@@ -6303,7 +6303,7 @@ sub process {
 				if ($stat =~ /$test/) {
 					my $val = $1;
 					$val = $6 if ($skip_args ne "");
-					if (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
+					if (($func =~ /^module_param/ && $val ne "0" && $val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
 					    ($val =~ /^$Octal$/ && length($val) ne 4)) {
 						ERROR("NON_OCTAL_PERMISSIONS",
 						      "Use 4 digit octal (0777) not decimal permissions\n" . "$here\n" . $stat_real);
Signature · 1 line
2.15.1
#1 lore raw

2017-12-11 11:48 GMT+01:00 Bartosz Golaszewski <[email protected]>:

Quoted 23 lines

File permissions set to "0" in the module_param family of macros mean that the parameter should not show up in sysfs. Don't require octal permissions in this case.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -2
index 040aa79e1d9d..32c37f8bc143 100755
@@ -6303,7 +6303,7 @@ sub process {
                                if ($stat =~ /$test/) {
                                        my $val = $1;
                                        $val = $6 if ($skip_args ne "");
-                                       if (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
+                                       if (($func =~ /^module_param/ && $val ne "0" && $val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
                                            ($val =~ /^$Octal$/ && length($val) ne 4)) {
                                                ERROR("NON_OCTAL_PERMISSIONS",
                                                      "Use 4 digit octal (0777) not decimal permissions\n" . "$here\n" . $stat_real);
--
Quoted 2 lines

2.15.1

Cc'ing Andrew Morton since checkpatch patches go through mm tree.

Thanks,
Bartosz