[Linux-kernel-mentees] [PATCH] checkpatch: add --fix option for OPEN_BRACE issues

Lukas Bulwahn lukas.bulwahn at gmail.com
Tue Nov 17 09:40:44 UTC 2020


On Tue, Nov 17, 2020 at 10:11 AM Dwaipayan Ray <dwaipayanray1 at gmail.com> wrote:
>
> On Tue, Nov 17, 2020 at 2:32 PM Lukas Bulwahn <lukas.bulwahn at gmail.com> wrote:
> >
> > On Tue, Nov 17, 2020 at 9:56 AM Dwaipayan Ray <dwaipayanray1 at gmail.com> wrote:
> > >
> > > Brace style misuses of the following types are now
> > > corrected:
> > >
> > > int foo(int bar,
> > >         int baz) { bar++;
> > >     return bar + baz;
> > > }
> > >
> > > int foo(int bar,
> > >         int baz) {
> > >     return bar + baz;
> > > }
> > >
> > > if (bar &&
> > >     baz)
> > > {   bar++;
> > >     baz++;
> > > }
> > >
> > > if (bar &&
> > >     baz)
> > > {
> > >     bar++;
> > >     baz++;
> > > }
> > >
> > > Signed-off-by: Dwaipayan Ray <dwaipayanray1 at gmail.com>
> >
> > Looks good to me. How did you test this? Did you run on a couple of
> > files in the kernel repository?
> >
>
> I have only run on some test cases I made, which also included the
> style misuses above. Finding files in the kernel for this exact check
> might take a bit work. Should I do that? I think these custom examples
> pretty much handles all the cases.
>

Well, it might be helpful to also submit some patches improving the
code to see if the cases where it would trigger actually fits to the
expectation of the maintainers, or if they intentionally have a
different style in mind.

I think it is worth running checkpatch to find such cases.

Lukas

> Thanks,
> Dwaipayan.


More information about the Linux-kernel-mentees mailing list