Re: [PATCH v3 2/5] media: uvcvideo: Use uvc_warn_once when it make sense

From: Laurent Pinchart

Date: Mon Sep 28 2026 - 08:29:54 EST


On Fri, Sep 11, 2026 at 01:22:26PM +0000, Ricardo Ribalda wrote:
> If there are multiple cameras in the system affected by a compliance
> error now we only show an error message for one of them.
>
> Use uvc_warn_once() to print an error message per device.
>
> Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> ---
> drivers/media/usb/uvc/uvc_video.c | 2 +-
> drivers/media/usb/uvc/uvcvideo.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index fc3536a4399f..2a3b7431cc68 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -95,7 +95,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
> */
> if (ret > 0 && query != UVC_GET_INFO) {
> memset(data + ret, 0, size - ret);
> - dev_warn_once(&dev->intf->dev,
> + uvc_warn_once(dev, UVC_WARN_QUERY_CTRL,

I thought about submitting a patch for this when I read 1/5 :-)

The only other usage of dev_warn_once() in the driver logs bad access to
the privacy control from userspace, which doesn't need to be logged per
device.

Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

> "UVC non compliance: %s control %u on unit %u returned %d bytes when we expected %u.\n",
> uvc_query_name(query), cs, unit, ret, size);
> return 0;
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index a80406f20beb..abcafd929c9e 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -661,6 +661,7 @@ static inline struct uvc_fh *to_uvc_fh(struct file *filp)
> #define UVC_WARN_MINMAX 0
> #define UVC_WARN_PROBE_DEF 1
> #define UVC_WARN_XU_GET_RES 2
> +#define UVC_WARN_QUERY_CTRL 3
>
> extern unsigned int uvc_clock_param;
> extern unsigned int uvc_no_drop_param;

--
Regards,

Laurent Pinchart