Re: [PATCH 6/7] fs/sysfs/group: make attribute_group pointers const
From: Greg Kroah-Hartman
Date: Tue Oct 10 2023 - 01:59:19 EST
On Mon, Oct 09, 2023 at 10:05:55PM +0200, Max Kellermann wrote:
> On Mon, Oct 9, 2023 at 7:24 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
> > Also, I don't know why checkpatch is happy with all the
> >
> > const struct attribute_group *const*groups;
> >
> > instead of
> >
> > const struct attribute_group *const *groups;
>
> I found out that checkpatch has no check for this at all; it does
> complain about such lines, but only for local variables. But that
> warning is actually a bug, because this is a check for unary
> operators: it thinks the asterisk is a dereference operator, not a
> pointer declaration, and complains that the unary operator must be
> preceded by a space. Thus warnings on local variable are only correct
> by coincidence, not by design.
>
> Inside structs or parameters (where my coding style violations can be
> found), it's a different context and thus checkpatch doesn't apply the
> rules for unary operators.
Ok, checkpatch support isn't always required, we can notice that changes
like this obviously are not sane and shouldn't be allowed just by
reading them :)
thanks,
greg k-h