Re: [PATCH] media: uvcvideo: Use scope-based cleanup helper

From: Markus Elfring
Date: Sun Jan 04 2026 - 05:39:04 EST


> Replace the manual kfree() with __free(kfree) annotation for data
> references. This aligns the code with the latest kernel style.

Align?



> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -291,7 +291,7 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream,
> struct uvc_streaming_control *ctrl, int probe, u8 query)
> {
> u16 size = uvc_video_ctrl_size(stream);
> - u8 *data;
> + u8 *data __free(kfree) = NULL;
> int ret;


How do you think about to reduce the scopes also for these local variables?


> @@ -317,8 +317,7 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream,
> "supported. Enabling workaround.\n");
> memset(ctrl, 0, sizeof(*ctrl));
> ctrl->wCompQuality = le16_to_cpup((__le16 *)data);
> - ret = 0;
> - goto out;
> + return 0
> } else if (query == UVC_GET_DEF && probe == 1 && ret != size) {


Did you accidentally overlook the need for another semicolon here?

Regards,
Markus