public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Andy Whitcroft <apw@canonical.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: don't require octal permissions for "0"
Date: Sun, 10 Dec 2017 18:19:03 -0800	[thread overview]
Message-ID: <1512958743.26342.32.camel@perches.com> (raw)
In-Reply-To: <20171210140401.7698-1-brgl@bgdev.pl>

On Sun, 2017-12-10 at 15:04 +0100, Bartosz Golaszewski wrote:
> If the permission value is 0, don't raise the NON_OCTAL_PERMISSIONS
> error. There's no possibility of an error if there are no permissions.
> 
> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 6b130a4116fa..ea98e298d3ac 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6321,7 +6321,7 @@ sub process {
>  				if ($stat =~ /$test/) {
>  					my $val = $1;
>  					$val = $6 if ($skip_args ne "");
> -					if (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
> +					if (($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);

perhaps
---
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 6b130a4116fa..950bbc0e6e3f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6321,7 +6321,8 @@ sub process {
 				if ($stat =~ /$test/) {
 					my $val = $1;
 					$val = $6 if ($skip_args ne "");
-					if (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
+					if ($func !~ /^module_param/ &&
+					    ($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);

  parent reply	other threads:[~2017-12-11  2:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-10 14:04 [PATCH] checkpatch: don't require octal permissions for "0" Bartosz Golaszewski
2017-12-10 22:56 ` Joe Perches
2017-12-11  2:19 ` Joe Perches [this message]
2017-12-11  9:39   ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1512958743.26342.32.camel@perches.com \
    --to=joe@perches.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=apw@canonical.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox