Re: [PATCH] pwm: core: Use octal permission

From: Uwe Kleine-König
Date: Wed Nov 18 2020 - 04:35:33 EST


On Wed, Nov 18, 2020 at 08:51:13AM +0000, Lee Jones wrote:
> On Tue, 17 Nov 2020, Soham Biswas wrote:
>
> > This fixes the following warning:
> >
> > `drivers/pwm/core.c:1341: WARNING: Symbolic permissions 'S_IRUGO' are
> > not preferred. Consider using octal permissions '0444'.`
> >
> > generated by the following script:
> >
> > `./scripts/checkpatch.pl --file --terse drivers/pwm/core.c`
>
> Oh, it's a checkpatch.pl thing.
>
> You should definitely quote the warning and describe where it came
> from in the commit log.
>
> Not entirely sure what that warning is the result of. Probably as
> they're sightly harder to read and easier to get wrong. Still, I'll
> let Thierry decide whether the patch itself is suitable for inclusion
> into the PWM core.
>
> > On Tue, 17 Nov 2020 at 23:42, Lee Jones <lee.jones@xxxxxxxxxx> wrote:
> > >
> > > On Tue, 17 Nov 2020, Soham Biswas wrote:
> > >
> > > > Fixed Warning.
> > >
> > > Which warning does this fix?
> > >
> > > > Replaced symbolic permission 'S_IRUGO' with octal permission '0444'.
> > >
> > > This is semantically equivalent.
> > >
> > > Not sure what and/or how this fixes anything.
> > >
> > > > Signed-off-by: Soham Biswas <sohambiswas41@xxxxxxxxx>
> > > > ---
> > > > drivers/pwm/core.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > > > index 1f16f5365d3c..a8eff4b3ee36 100644
> > > > --- a/drivers/pwm/core.c
> > > > +++ b/drivers/pwm/core.c
> > > > @@ -1338,7 +1338,7 @@ DEFINE_SEQ_ATTRIBUTE(pwm_debugfs);
> > > >
> > > > static int __init pwm_debugfs_init(void)
> > > > {
> > > > - debugfs_create_file("pwm", S_IFREG | S_IRUGO, NULL, NULL,
> > > > + debugfs_create_file("pwm", S_IFREG | 0444, NULL, NULL,

Actually I'd prefer keeping the symbolic name because this is easier to
grep for. So to convince me a better reason than "checkpatch says so" is
needed.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature