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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4016DC4345F for ; Thu, 18 Apr 2024 10:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zLddySjki13kmfqWaSOsUVYN3jXGM+Py74FDzwtF1Jw=; b=pXHNMN7mY24qi9ViYCL33HaoAU rChnW5CV5z3mQKKV2emWY7NTVCyxLg6fY0PGgIvr/2Q1AjHyaXkFNdZGPZ64gvaWOMUpcXviIF4NG 9vbnG8Zd2UJzxix0XHYvJaAGOpjJx+8+dgKl2kTC10a7KhroBRQF3QnbP+pF85jeaBlzd/86jo/z9 fGaCQaTOrhii/7gw2QPJ81Htkz99zcE3UxMyzTXMtuPJB7eJunvd8KNXj9ONMJOB6uBQKq56lyS1A r/cof1CB8DwI+uvWyIPAaAHsfueK0M/AzyVRy9KWZIijXAC52YUp4elRDwxfJiQHUoGDsvPr0XUFU 0s6IGkdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxPPj-00000001tS6-3bNA; Thu, 18 Apr 2024 10:54:47 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxPPd-00000001tOq-3RyW; Thu, 18 Apr 2024 10:54:45 +0000 Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C9F7827; Thu, 18 Apr 2024 12:53:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713437633; bh=qmeQraQobwFJ1DUcADmA6F6yy0zqT0LaiY4LgwR4qkU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P0IlIS+ziVDtl4f60+Ieht6xhGxxe1vPBTPIJV2vEE6YXwaMvW9C341eya7vHrgKn hDDs3rdw0lyWR3hpZCcC/KKbyKqWJe5yo7Kqsp9X1M/SqQt40ZksufpkG9TFdDRKWc 22mGTs51GSx/t1hfv3CzS2X37iOyRbA7KYKIFm1s= Date: Thu, 18 Apr 2024 13:54:33 +0300 From: Laurent Pinchart To: Ricardo Ribalda Cc: Martin Tuma , Mauro Carvalho Chehab , Hans Verkuil , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Niklas =?utf-8?Q?S=C3=B6derlund?= , Pavel Machek , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 04/35] media: uvcvideo: Use max() macro Message-ID: <20240418105433.GW12561@pendragon.ideasonboard.com> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> <20240415-fix-cocci-v1-4-477afb23728b@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240415-fix-cocci-v1-4-477afb23728b@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240418_035442_074255_AC3B9157 X-CRM114-Status: GOOD ( 14.79 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Mon, Apr 15, 2024 at 07:34:21PM +0000, Ricardo Ribalda wrote: > It makes the code slightly more clear and makes cocci incredibly happy: > > drivers/media/usb/uvc/uvc_ctrl.c:839:22-23: WARNING opportunity for max() > > Signed-off-by: Ricardo Ribalda > --- > drivers/media/usb/uvc/uvc_ctrl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c > index a4a987913430..4b685f883e4d 100644 > --- a/drivers/media/usb/uvc/uvc_ctrl.c > +++ b/drivers/media/usb/uvc/uvc_ctrl.c > @@ -836,7 +836,7 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping, > while (1) { > u8 byte = *data & mask; > value |= offset > 0 ? (byte >> offset) : (byte << (-offset)); > - bits -= 8 - (offset > 0 ? offset : 0); > + bits -= 8 - max(offset, 0); I don't think this really improve readability. > if (bits <= 0) > break; > -- Regards, Laurent Pinchart