Re: [PATCH 6/9] media: uvcvideo: Do not enable camera during UVCIOC_CTRL_MAP32

From: Hans de Goede
Date: Mon Jun 02 2025 - 05:47:48 EST


Hi Ricardo,

On 28-May-25 19:58, Ricardo Ribalda wrote:
> The device does not need to be enabled to do this, it is merely an
> internal data operation.
>
> Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
> index 65c708b3fb1066bf2e8f12ab7cdf119452ad40f9..2c6f3cf6bcc3f116bbdb3383d9af7d5be9832537 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -1224,10 +1224,6 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
> void __user *up = compat_ptr(arg);
> long ret;
>
> - ret = uvc_pm_get(handle->stream->dev);
> - if (ret)
> - return ret;
> -
> switch (cmd) {
> case UVCIOC_CTRL_MAP32:
> ret = uvc_v4l2_get_xu_mapping(&karg.xmap, up);
> @@ -1245,7 +1241,13 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
> ret = uvc_v4l2_get_xu_query(&karg.xqry, up);
> if (ret)
> break;
> +
> + ret = uvc_pm_get(handle->stream->dev);
> + if (ret)
> + return ret;

The rest of the code here uses:

if (ret)
break;

as pattern, please also use that for the uvc_pm_get() error handling

Otherwise this looks good to me:

Reviewed-by: Hans de Goede <hansg@xxxxxxxxxx>

Regards,

Hans




> ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry);
> + uvc_pm_put(handle->stream->dev);
> +
> if (ret)
> break;
> ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
> @@ -1258,8 +1260,6 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
> break;
> }
>
> - uvc_pm_put(handle->stream->dev);
> -
> return ret;
> }
> #endif
>