[Linux-kernel-mentees] [PATCH] checkpatch: add --fix option for OPEN_BRACE issues
Dwaipayan Ray
dwaipayanray1 at gmail.com
Tue Nov 17 12:16:25 UTC 2020
On Tue, Nov 17, 2020 at 3:17 PM Dwaipayan Ray <dwaipayanray1 at gmail.com> wrote:
>
> > > 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.
> >
> Okay thanks! I will try to find out some of those.
I checked out some conversions over the kernel files and
it's working pretty much as intended.
For example in
fs/f2fs/segment.c:
static int report_one_zone_cb(struct blk_zone *zone, unsigned int idx,
void *data) {
memcpy(data, zone, sizeof(struct blk_zone));
was converted to:
static int report_one_zone_cb(struct blk_zone *zone, unsigned int idx,
void *data)
{
memcpy(data, zone, sizeof(struct blk_zone));
The brace positioning is correct after the fix.
Another instance in net/netfilter/xt_IDLETIMER.c:
if(ret < 0)
{
pr_debug("checkentry helper return invalid\n");
return -EINVAL;
}
was changed to:
if(ret < 0) {
pr_debug("checkentry helper return invalid\n");
return -EINVAL;
}
which is again I think the correct fix according to the
conventions.
What do you think Lukas?
Thanks,
Dwaipayan.
More information about the Linux-kernel-mentees
mailing list