Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1690511lqp; Mon, 15 Apr 2024 14:07:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgHJ2Tx34WVa4kKwJfty2s+FVd890qpcewLrgiEow4F15S1A9IpxmDRdhvGeTjppVHpyPF2t+noQBYdVzGACaklE3m4WC0m6oJzlPsng== X-Google-Smtp-Source: AGHT+IGIXSzxsSAo5E42Vt8MYJJR6lbwJcYnHRvANlUFTMdR4L1B4cJ696fUgeuFbu3C3q8LVPlj X-Received: by 2002:a0c:ef51:0:b0:69b:7b36:30fd with SMTP id t17-20020a0cef51000000b0069b7b3630fdmr4520137qvs.29.1713215238381; Mon, 15 Apr 2024 14:07:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713215238; cv=pass; d=google.com; s=arc-20160816; b=piTQ04xTOFQofGKEBT/Om6Y6RUYphelQl6qCK9VfGcF6863zvBokUxj7v/drZH4HzL FvoSSqsM5HE+9IwHRBoh9Nr53uYWu1m3Cy37g7nvAbzQ2WJJY+69Cetrwyx+YmL80e8t qyPQeXP6mBLpZlY7YkNfLNYm7y8mwPXlqD2Msvy1LjtCVlRcfsLVvrbF8uLOyr0VCDKM OlANbegL36T2KUagbYIJzvxnqmpM3QJz4gE233QygKgFpWRymUGNN83GV+loqUVKdGHU /cuxnmwatXSPIH04ph8lPDt1eoWxUjmkc2zsOKQouxH7npq+VLrLsffYX9H+5L/UIQha MSzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:message-id:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=DO3m2iSYrB9egTqY9X7+1nPCAo8K87z629ag4J+iPrM=; fh=oz6pxVeuJgZ+SL/nXUefy+OhsvWQX+D7e4mLsCEioKY=; b=ITnyfe6enKtz9R89YX67l5IijU2Ix/Ovod3zOWfTGDuIERfh4aYjKiVUKp3vXEgkYW c94HCiuxzgtguZoBNFmIrpjjnZ1sS0tdWSLMySHrwt/ix5Kncl3LAzphM92QK7GmCAZ3 vd2b01fY/z4jwuL58ExxJGCqSU/+onSLY+S3MhULYrSIkqE00t0xVofhxP9kwzNULGFw WNrUeq3Fbk3trg8au+EFGqr83UB1hDZM/u7vcf4mP/0FSokXccYYC3RWk5XdjwvzYQny xQIcEsMeN38xvGZJwnnH72lXu/E/hru4nyre9UfjMs0Pg13QkAvB6gHXd6w+PkACGw8z cpmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@ideasonboard.com header.s=mail header.b=rdukYCQh; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-145906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145906-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 5-20020a05621420c500b0069b5f5c3d73si9364944qve.172.2024.04.15.14.07.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 14:07:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@ideasonboard.com header.s=mail header.b=rdukYCQh; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-145906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145906-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0177B1C21133 for ; Mon, 15 Apr 2024 21:07:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF8A6156672; Mon, 15 Apr 2024 21:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rdukYCQh" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BBB8156C53; Mon, 15 Apr 2024 21:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713215218; cv=none; b=PfXHU36jjkHUx8fwNd1DsbbPknLMFXNgJf9Kh6sM5IS+tLFxsVYHzl+H8CXUUhgQc0rV3KSmq+aETHIhbpiv+rwSHvaTxbNPOwGa8aopDm/5KYuFYGpy9ZfN8ql+qaJxjVuH4s39MS8jG4zrRJ6lw89cTWwY8Jq7uS5RDHjkPQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713215218; c=relaxed/simple; bh=QK/YnNEsRDQzA+VI9ZfCIug3P5VhevsltSl+SmjeDe0=; h=Content-Type:MIME-Version:In-Reply-To:References:Subject:From:Cc: To:Date:Message-ID; b=hzNApZIFHBIzCRrVkeu1qlOh2GfZH1MGwgHOVmXbPfJxbTGYbfUry49ojrewFBsgfTXPRDf76xK7onjQrEAEePBYWoFQZAFzgr3uqDB5Z/xPElJIG+sO1lkwy9/toZ6f1tcDNhK1Tf9CH3BE0l77pJKDqQkGPrecjNZOe1O2qRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=fail (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=rdukYCQh reason="signature verification failed"; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1F57F497; Mon, 15 Apr 2024 23:06:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713215167; bh=QK/YnNEsRDQzA+VI9ZfCIug3P5VhevsltSl+SmjeDe0=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=rdukYCQh9mMFKAPdTqd4jo4lB4a4B7xptpHd357YCY6nsrtHDE8p4O2e61Yb+mMxi yKJPDLBT5H6E9wcVtgSM3TW7Vas5B4YrUJkgnLXrP6kJ0tc0rBjudUOeDKylS3L9Le RHF8woqIolcFMRosZ1uhKhaSSd4+78XmA8SkQZdg= Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240415-fix-cocci-v1-4-477afb23728b@chromium.org> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> <20240415-fix-cocci-v1-4-477afb23728b@chromium.org> Subject: Re: [PATCH 04/35] media: uvcvideo: Use max() macro From: Kieran Bingham Cc: 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, Ricardo Ribalda To: Abylay Ospan , Alain Volmat , Alexandre Torgue , AngeloGioacchino Del Regno , Benjamin Mugnier , Bjorn Andersson , Bryan O'Donoghue , Chen-Yu Tsai , Dmitry Osipenko , Ezequiel Garcia , Greg Kroah-Hartman , Hans Verkuil , Hans Verkuil , Hugues Fruchet , Jacopo Mondi , Jernej Skrabec , Jonathan Hunter , Konrad Dybcio , Laurent Pinchart , Laurent Pinchart , Luca Ceresoli , Martin Tuma , Matthi as Brugger , Mauro Carvalho Chehab , Maxime Coquelin , Niklas =?utf-8?q?S=C3=B6derlund?= , Paul Kocialkowski , Pavel Machek , Ricardo Ribalda , Sakari Ailus , Samuel Holland , Sergey Kozlov , Sowjanya Komatineni , Stanimir Varbanov , Sylvain Petinot , Thierry Reding , Vikash Garodia Date: Mon, 15 Apr 2024 22:06:49 +0100 Message-ID: <171321520986.2333277.5902882675169324919@ping.linuxembedded.co.uk> User-Agent: alot/0.10 Quoting Ricardo Ribalda (2024-04-15 20:34:21) > It makes the code slightly more clear and makes cocci incredibly happy: >=20 > drivers/media/usb/uvc/uvc_ctrl.c:839:22-23: WARNING opportunity for max() >=20 > Signed-off-by: Ricardo Ribalda > --- > drivers/media/usb/uvc/uvc_ctrl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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_mappin= g *mapping, > while (1) { > u8 byte =3D *data & mask; > value |=3D offset > 0 ? (byte >> offset) : (byte << (-off= set)); > - bits -=3D 8 - (offset > 0 ? offset : 0); > + bits -=3D 8 - max(offset, 0); This looks semantically the same to me so: Reviewed-by: Kieran Bingham > if (bits <=3D 0) > break; > =20 >=20 > --=20 > 2.44.0.683.g7961c838ac-goog >