Re: [PATCH] tracing user_events: Simplify user_event_parse_field() parsing
From: Steven Rostedt
Date: Mon Jan 08 2024 - 17:12:23 EST
On Mon, 8 Jan 2024 21:47:44 +0000
Beau Belgrave <beaub@xxxxxxxxxxxxxxxxxxx> wrote:
> > - len = str_has_prefix(field, "__rel_loc ");
> > - if (len)
> > - goto skip_next;
> > + if (!(len = str_has_prefix(field, "__data_loc unsigned ")) &&
> > + !(len = str_has_prefix(field, "__data_loc ")) &&
> > + !(len = str_has_prefix(field, "__rel_loc unsigned ")) &&
> > + !(len = str_has_prefix(field, "__rel_loc "))) {
> > + goto parse;
> > + }
>
> This now triggers a checkpatch error:
> ERROR: do not use assignment in if condition
What a horrible message.
> #1184: FILE: kernel/trace/trace_events_user.c:1184:
> + if (!(len = str_has_prefix(field, "__data_loc unsigned ")) &&
>
> I personally prefer to keep these files fully checkpatch clean.
I've stopped using checkpatch years ago because I disagreed with so much it :-p
(Including this message)
> However, I did test these changes under the self-tests and it passed.
>
> Do they bug you that much? :)
No big deal if you prefer the other way. I was just doing an audit of
str_has_prefix() to see what code could be cleaned up that uses it, and I
found this code.
If you prefer to limit your code to "checkpatch clean", I'll leave it alone.
-- Steve