Re: [PATCH v1 1/1] ALSA: control: Use list_for_each_entry_safe()
From: Andy Shevchenko
Date: Tue Aug 29 2023 - 10:21:18 EST
On Tue, Aug 29, 2023 at 04:10:24PM +0200, Jaroslav Kysela wrote:
> On 29. 08. 23 15:52, Andy Shevchenko wrote:
...
> > Takashi, if you have anybody or want yourself to spend some time,
> > I believe you can simplify a lot the parser in this file with
> > the help of lib/cmdline.c APIs.
>
> You probably mean next_arg() function. Unfortunately, it does not handle all
> cases we need to parse. The control IDs are a bit different than standard
> arguments.
Not only that, but also get_option() / get_options().
It might still make sense to look into and expand next_arg() to do
what you want (like I have done to get_option() which later allows
to have parse_int_array_user() be implemented).
It also have test cases, which can be expanded / amended as well.
...
> > - list_for_each_entry(lctl, &led->controls, list)
> > + list_for_each_entry(lctl, _lctl, &led->controls, list)
>
> The list_for_each_entry_safe() should be used here, too.
Oh, good catch!
> With the fix:
>
> Reviewed-by: Jaroslav Kysela <perex@xxxxxxxx>
Thank you, I'll send a v2 soon.
--
With Best Regards,
Andy Shevchenko