From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1B22C3DA7A for ; Thu, 29 Dec 2022 03:28:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231635AbiL2D2l (ORCPT ); Wed, 28 Dec 2022 22:28:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbiL2D2i (ORCPT ); Wed, 28 Dec 2022 22:28:38 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53A113D59; Wed, 28 Dec 2022 19:28:37 -0800 (PST) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1AF0B109; Thu, 29 Dec 2022 04:28:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1672284516; bh=IdUNGMBGY8cIigGTuFXoxeut6tWYUHexeWDammMcYhc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fC0EiT6hRTDtsbUvO9eiN9Eg2f0+rzvE+Vnra9L85atHg51pqnnoownETLqeCQW6w 9VRHXUXLVR/st5bybsLo0OHQzNnvkItIwjMRrSvWtLJ7QZ1IhAUA3BFpBWsxVqjbxR kFcvTfRLSGixLsN7TQTY647bMZ/1wannkN2nbvCY= Date: Thu, 29 Dec 2022 05:28:32 +0200 From: Laurent Pinchart To: Ricardo Ribalda Cc: Mauro Carvalho Chehab , Hans Verkuil , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil Subject: Re: [PATCH RESEND v2 4/7] media: uvcvideo: Do not return positive errors in uvc_query_ctrl() Message-ID: References: <20220920-resend-v4l2-compliance-v2-0-b0ceb15353ac@chromium.org> <20220920-resend-v4l2-compliance-v2-4-b0ceb15353ac@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220920-resend-v4l2-compliance-v2-4-b0ceb15353ac@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ricardo, Thank you for the patch. On Fri, Dec 02, 2022 at 06:21:38PM +0100, Ricardo Ribalda wrote: > 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. The commit message should explain why: this will avoid confusing the caller (and ultimately userspace) that doesn't expect a positive or zero value. > Suggested-by: Laurent Pinchart > Signed-off-by: Ricardo Ribalda I'll update the commit message locally. Reviewed-by: Laurent Pinchart > --- > drivers/media/usb/uvc/uvc_video.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c > index 497073a50194..902f2817a743 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. */ > -- Regards, Laurent Pinchart