Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1652775lqp; Mon, 15 Apr 2024 12:42:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNbczTJ6s6chy/3p788l2nWgoPbIHIqkUO3vn5Vq+FmWt555HWJreHXs4RqdaKvOqil+l6eO/FfCDg/yeuJ0uvbvtbigHmivwDaWmDcw== X-Google-Smtp-Source: AGHT+IGDm71W4kAh3Wn+7OT4Xl7G/gCWe+BMaHkWCJItM/7MUA5aod3HucvVk6z915727xoBMknG X-Received: by 2002:a17:902:d4cf:b0:1e5:86da:3eae with SMTP id o15-20020a170902d4cf00b001e586da3eaemr14267871plg.3.1713210172372; Mon, 15 Apr 2024 12:42:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713210172; cv=pass; d=google.com; s=arc-20160816; b=zP1WZZg+jpXBlC77ap//izM6L/5omkqNEEQO5g5qyb99ekhH4OTFHVIHINObVmb2GZ Oi4CbhB6eEPTwSGR7PBGat6yc0+cWt8ILTS/q6UJUs0ZEKpqi/h0zHvwVaF5mgpHZdsO 6bm1V3TXGaQxbFjIkcj5zwxRI/IF5q9nWiTzQL2CQZ3I97qK55936oRbx8uJvMwf9mEL TD0/kvoztxfHU3Fkdl0jpOLfJMKJwoUftLAdTYQYpywsOO2dLaEbc2ehbhTXe57uk6H6 5jE2hD/9vuiKHex/oUuXG6DCcUWBiYZiBwjhxP3yeHL7opidmygsTuZSGE1u9gQwo/4O Ytgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=cKMvbnJBvce6w6rhgAtTaziLR0gQM5TDA935faRghdc=; fh=jgokTRIGFLo/KVHiwCpiiURzPZ1NK7cWWfpZUfkDY2Y=; b=o3E26wyT3PEyhuA1aItsPYPurwU51VNFDWIsGtUFqzttnY81/8eF4qfCasABttkWPu zq5qjHyfn7UQ7UG5TnXL8XCtPGkqANMlgoJ0QlKGlbCmmPaBaly1zC4N8EM99eJ3Zi1Y H843knVxlGph0x4d3BEMHTHhJb3ys6snNHdW/7lp/EfjlgvSFkWVIoIcz5VHq7NmrFEy i6q90dojF9MxHnsjLyonejhUMFA0xD1ezxGENVx0cBHqxuLZaF5bNUCAmMgVEYkrkFza 4alnLpHOLk39kzNrnOIDdV2z/3xHyb73EPohLr7IgtSOd/R4YK4kovy/Kejz81618ysM zp2Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Bm+x/cvY"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145803-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 u7-20020a170902e80700b001e2a41d265esi8396105plg.324.2024.04.15.12.42.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:42:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145803-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 header.i=@chromium.org header.s=google header.b="Bm+x/cvY"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145803-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 A8FCF2844AC for ; Mon, 15 Apr 2024 19:42:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B57E160797; Mon, 15 Apr 2024 19:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Bm+x/cvY" Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A10815F311 for ; Mon, 15 Apr 2024 19:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209694; cv=none; b=CvdaBKARIMPTl7ypRPQIaQ39X0W74RC7UbUHrGsEGuc+j7gFJE7x2BghUN/Z1Oob3qS5UrClLY4U3sWYOMGQfT5kPP/g7hsydAvx9zgBClJf9yAKeOrFLnhvTo8Hf5AxF+v8ylVgZiASf50PF20WYLLa+2qkM1nRNjpdnqRIQUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209694; c=relaxed/simple; bh=uneKQTx7g7YpgV1qfns0GCADDeBeNkX9SjOTc7QrTqo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ePYo0qVmqhr8/HlrXH3byHxBSS1OlP79VgoY/zTvyg3JiG9NPtpNzG+R+tbcg4dBsL8sNflhmzy+GnIHVhD/mG5muNosZLKmcFtpWHleONykjxNlK+b8ZFCBPrmiUxmzBReFfGfnIn4/Q1yO2f0Y+NFTiefBmrRuczagiuqwKG0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Bm+x/cvY; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-78edc3e7cd9so133692385a.1 for ; Mon, 15 Apr 2024 12:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209690; x=1713814490; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cKMvbnJBvce6w6rhgAtTaziLR0gQM5TDA935faRghdc=; b=Bm+x/cvYDDS35S+SV5eBbryfuSZp1I06tJ0xORnrS0HU7AASYib40HiF0xymOtavtD mJsqVTdjeYfTb0YncAMLOHRE9APXiCNeZl60oECKbgCjFouzYNB4e39qb0ryFG2VZx1v MLMlscL8vIsHRblFexsICkstJd0UkJkp5Bj08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713209690; x=1713814490; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cKMvbnJBvce6w6rhgAtTaziLR0gQM5TDA935faRghdc=; b=Oq6DiWQ7PRkdxLYvHc60ck2WTsMke06HUxcRWPvjsa58jxJShiZISiV7QmuY3VMHPS SdB5NYIPrzQ2OVX5117HhNiSPpkfpwsKNrFlesFiMmpYyKKZJ3p8ppJ0kJBu9dxsOexJ diLeA6pIbfRDJjBLtmHZOstbudoOOjR9glC8p/0cQCAu4InsYyxYBGcVfDMRnwJ7AycK QQCG56hLAL3OfRW+Y3yPheAKVWfBR7t0y6OAL2b1nmZdYci8O7fqfNvAbzf33V1dwhs3 ez5Lumv561wEaabdG7VBfneZdke0JvEBSAFJouiJtv/4TzHocL2sF2uw9RCLBI7OK/UM NBdQ== X-Forwarded-Encrypted: i=1; AJvYcCUwR+esnZpTJkaDz8Ac+Qb9Qe01XYnoQoeivEnU9JF7erPLPDEo1v53KQeLtQnNtvczH7TqjqiDAKmrBwF3oe0OxxzNmrPnWbYtTr/P X-Gm-Message-State: AOJu0YxWmdy9wczAM+/gIxEUmNdwybutDz/FYFd5FJzMSrDw4BTNPp9u yaNw43SNVk7o9UBU5K69zhiiD5e00mBv5n1wiW+J8qn2YBtbgq39jarEAT3x3Q== X-Received: by 2002:a05:620a:4486:b0:78d:65e0:3100 with SMTP id x6-20020a05620a448600b0078d65e03100mr15166755qkp.60.1713209690125; Mon, 15 Apr 2024 12:34:50 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id s26-20020ae9f71a000000b0078d3b54eb76sm6718055qkg.78.2024.04.15.12.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:34:49 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 19:34:36 +0000 Subject: [PATCH 19/35] media: stk1160: Use min macro 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-Transfer-Encoding: 7bit Message-Id: <20240415-fix-cocci-v1-19-477afb23728b@chromium.org> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> In-Reply-To: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , 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 , Laurent Pinchart , =?utf-8?q?Niklas_S=C3=B6derlund?= , Pavel Machek 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 X-Mailer: b4 0.12.4 Simplifies the code. Found by cocci: drivers/media/usb/stk1160/stk1160-video.c:133:12-13: WARNING opportunity for min() drivers/media/usb/stk1160/stk1160-video.c:176:13-14: WARNING opportunity for min() Signed-off-by: Ricardo Ribalda --- drivers/media/usb/stk1160/stk1160-video.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c index 366f0e4a5dc0..0ba0f41fe3f4 100644 --- a/drivers/media/usb/stk1160/stk1160-video.c +++ b/drivers/media/usb/stk1160/stk1160-video.c @@ -130,10 +130,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) dst += linesdone * bytesperline * 2 + lineoff; /* Copy the remaining of current line */ - if (remain < (bytesperline - lineoff)) - lencopy = remain; - else - lencopy = bytesperline - lineoff; + lencopy = min(remain, bytesperline - lineoff); /* * Check if we have enough space left in the buffer. @@ -173,10 +170,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) src += lencopy; /* Copy one line at a time */ - if (remain < bytesperline) - lencopy = remain; - else - lencopy = bytesperline; + lencopy = min(remain, bytesperline); /* * Check if we have enough space left in the buffer. -- 2.44.0.683.g7961c838ac-goog