Re: [PATCH 03/35] media: uvcvideo: Refactor iterators

Markus Elfring
2024-04-16T07:05:26Z

I would find a hint for a variable change more appropriate in the patch subject
instead of the word “iterators”.

…
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
…
> @@ -2175,16 +2177,16 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
> int ret;
>
> /* Find the extension unit. */
…
> + entity = NULL;
> + list_for_each_entry(iter, &chain->entities, chain) {
…

I suggest to move this assignment into the definition for the affected local variable.

By the way:
I see another source code adjustment opportunity in this function implementation.
https://elixir.bootlin.com/linux/v6.9-rc4/source/drivers/media/usb/uvc/uvc_ctrl.c#L2165

Can it be nicer to use labels “free_data” and “unlock” (instead of “done”)?
How do you think about to increase the application of scope-based resource management here?

Regards,
Markus