Commit a763b9fb authored by Ricardo Ribalda's avatar Ricardo Ribalda Committed by Laurent Pinchart

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Suggested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 44cdba41
...@@ -83,7 +83,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit, ...@@ -83,7 +83,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
dev_err(&dev->udev->dev, dev_err(&dev->udev->dev,
"Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n", "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n",
uvc_query_name(query), cs, unit, ret, size); uvc_query_name(query), cs, unit, ret, size);
return ret; return ret < 0 ? ret : -EPIPE;
} }
/* Reuse data[0] to request the error code. */ /* Reuse data[0] to request the error code. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment