Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1219772lqb; Thu, 18 Apr 2024 03:55:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5EePNW3aPzSBDprLPpIbFCxLbitoRG07/s1YZddva/U1jOxG6ukQ2IeEkf4YVa+3l1nKk788Kv04zlnqB4zcf9CYlfELW4hfSice0yA== X-Google-Smtp-Source: AGHT+IE2sVQ++rWI7DE4y3OfwTfItHVvGgCTyIK5lobdLo+sSt25EBPIQ5hNdtKbOq1m9aKc0r6R X-Received: by 2002:a17:90a:530e:b0:2a2:d05c:95f6 with SMTP id x14-20020a17090a530e00b002a2d05c95f6mr3146599pjh.7.1713437721622; Thu, 18 Apr 2024 03:55:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713437721; cv=pass; d=google.com; s=arc-20160816; b=cEaQKaKdZvLiDY3EM2ugw051r72WI3qAxA25R+xxiEmrOl8vdlB1BXlDz10wsTdltq EcmUCQqsm2RBByjcczWL0LZwdayH+lrfx9zrhgyNz4h2+WpkRDo6Ej9hLhOCeQzxyxTn 5T/Fm7fRknAtXGe8PeY1HtgzUOQJeSbC4j2Lbz0xmS2iZwo3hOeKPesvYbWGobL/nIcX IJYx2rZMrzhHNZ+cr2HuzJWTMAUATaHoZuT3Np8FA1uS8N8DgpfNYEvyfhx/5eFcajfn xOHcaTksCwk9dG2mBY+xFv+5oEiVzDv7n4W/eOUcH6QC8M6YYBSE3OK8L0HIuqhbF+r/ vdTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zLddySjki13kmfqWaSOsUVYN3jXGM+Py74FDzwtF1Jw=; fh=EWXaWrV+NNEysXm1o/RP9qQhWuk7+ngVBRGy4zSFZ1g=; b=sdJb7re4HSCsPbt6lowGNfn2N6Ip1NJz77Kn95qQw4puN81uSQjEQ/Dj4+TRUPtcdc en2GunPbntK9vsx+eqX3iNAUn1oXmoesH1QC5EvMwe2VKrOVzKaxduSNNqYu+jwaCTiL MJMehjEhS7Mm+KlL9laV/yPl6iYuBZXh/MD9HRaTXOJbCM2F0acjHTakkje68F5a9R3Y iMuehpC3Il5pjRwV1/S0HKqD2Xq0Q8tPhnYM+wMVAy6epvxQYu+1nSQSKEvv0WiVwphP oyoJR62s+AIp76Jf+jy3q0XylqbDeZPHKFdBJqEkR6aj5cMA/2XNqJTgB0X9uCt1gyqC /7gQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=P0IlIS+z; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-149927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149927-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 17-20020a630a11000000b005cee03a5355si1125307pgk.518.2024.04.18.03.55.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 03:55:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=P0IlIS+z; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-149927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149927-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 47593282517 for ; Thu, 18 Apr 2024 10:55:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5387715E7E7; Thu, 18 Apr 2024 10:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="P0IlIS+z" 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 3075D15DBD8; Thu, 18 Apr 2024 10:54:42 +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=1713437683; cv=none; b=TwkGOX/3FBp1e0ogiOXDhtFGwsyDnhSOOfD6vMz/jtkPHlOR0yG/2B5G5Ciq+ZLmqkA8eleisqB1lfHrQhQKTkhHozNCcBzbcJrEZPzbLx5FZRWfXuU+XXZeXDPGun/Mg/KCzGPS1PanZ3Z+m40iRMwlwBYvmJTuwjqpoYNFgdM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713437683; c=relaxed/simple; bh=qmeQraQobwFJ1DUcADmA6F6yy0zqT0LaiY4LgwR4qkU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GvTSykOJsxoVBEGif7Hd2BAVa3Pxr3eCVQrykJ9XZKJB5ENdoHUywokl+OfTVthYwGGnUvqIuHUmBEniXFMuYFGBBEV4A2SYoXhfOGpy6i1l3Dh8DE/m6xRSNxCZu+mB7DETfNL41vVpWn95mVBoJQJWzvzsHYr/TBMRG+2z9AM= 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=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=P0IlIS+z; 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 (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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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> 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