diff options
author | Ricardo Ribalda <ribalda@chromium.org> | 2023-01-03 17:36:22 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2023-01-16 00:45:12 +0300 |
commit | a763b9fb58be869e252a7d33acb0a6390b01c801 (patch) | |
tree | 177060bb352348ce8f1ed792fa4c6540b5786546 /drivers/media/usb | |
parent | 44cdba4130ecdb59ff94c617b6cd8dc22b4f3c97 (diff) | |
download | linux-a763b9fb58be869e252a7d33acb0a6390b01c801.tar.xz |
media: uvcvideo: Do not return positive errors in uvc_query_ctrl()
If the returned size of the query does not match the expected size or it
is zero, return -EPIPE instead of 0 or a positive value.
This will avoid confusing the caller (and ultimately userspace) that
doesn't expect a positive or zero value.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/uvc/uvc_video.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 3d3753a4c1f8..e4b71df08216 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -83,7 +83,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit, dev_err(&dev->udev->dev, "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n", uvc_query_name(query), cs, unit, ret, size); - return ret; + return ret < 0 ? ret : -EPIPE; } /* Reuse data[0] to request the error code. */ |