From patchwork Fri Apr 19 09:48:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13636060 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 E07F4C4345F for ; Fri, 19 Apr 2024 09:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=abb11M8114OIWGtfTSUNZy/TSVJSWZvpLeA6HDz9Bic=; b=GTsUtCIW6GIRBl naBLOFopKQiR8axL8VT7mtzlcktXtEy1mfRL7cudoRZmdrGJwIBQA8UORtE5VnrjyGlOjA/lr3Jvg kMIwskCRbOeomDcFFyXTmpHIozmCl8Ejn20/x4DLYbKp/FSy/WoWzurq9HogfiLX9xEvkd8OsUFJ2 fs+wj9rfR+ePl5UeOKGEd3rVSedwirz5izifcvTPLx6I3L471NoLI0/4E6/0ZSEujh7ffEoBfITMm jr+ccv+qHRBXzLdyd6u8UOpZXVvJpEQQXk0Cxg63GVGh9Z0ULemMd6kSiJTG2WfWwn5AFTcQH2l3F I+B07BHUuatGnTgl5XCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxktf-000000059sB-2r5T; Fri, 19 Apr 2024 09:51:07 +0000 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksF-0000000591C-12NS for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:49:45 +0000 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-78f02298dc6so151338185a.1 for ; Fri, 19 Apr 2024 02:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520178; x=1714124978; darn=lists.infradead.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=M868xcge+vjTb4vcqz3d1wlm8C5wkLs//kWdILTOdIY=; b=cwjfvOc5t2/Rv8qFUttYxYGvFXodHL/LaHscuwkq7i+GErkNpmRuwsKxJYFlkyKaeA 19uiywWsU0w3Wh+RLGG7PLxL11teL5DQEKqx/ilVfkwSOcauWBgLAkykKXGo5i0LOdou bnfCTV/ZM8EA3JoyguDgIkCZPvfGF2Snbpi3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520178; x=1714124978; 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=M868xcge+vjTb4vcqz3d1wlm8C5wkLs//kWdILTOdIY=; b=XZIUN3aOvR/L+IvWJy+elh6rFfLGjKL61I/WkE2KKswt+YuzT+isv0JtpfPpgTKFWc f3d+GJxwokzoSAnCueqr7U2CHkw4pWx5R17s1PUQXSWl/QWg5Q8ok2uNT9ik11iJhOjV e4aPH88uJinAztwjHzfxakawXmLVaC3VJgmDE08rd2fEoVDr6fWLjl/Wu2xTr/rvYZe+ Vit3x2xli7++bftaEP/Hvbd0dS5CXnm0QMRARUNKgurXOJ1IczKVgPHpVMHpXJjv6MIh c96gD0FYV2F38R/Ilr5wmq3BXDmtPJEEdhPUm/evjnrZChHi8SxXJ1uuCBzC8fggH+Cb xdrQ== X-Forwarded-Encrypted: i=1; AJvYcCX0AMyK0j6ewj6H6g08zCLmrwOHr9x0sawmppr0F6XA7yeGjvMbB9bEZtZ1KR5mQxnkjZR1Wvc0a4EcF1P+P4pTlmJUzt7QRSQBCxHCyyhejmeAoVw= X-Gm-Message-State: AOJu0YxeTjDwGj8+vn73wf9yG5frabWdDYETDNJiwTGAs50OwsxdjGK/ gGIBe8ccHoVpsJbtCRAtgr5Ct6Y9BbN1TCOoG8Qx/oX2j0i4W8BjYeh/xiSdTA== X-Google-Smtp-Source: AGHT+IECi6Jyi4V4xEUSov8CqJCQ4or6T8Il7gtYs1qBNIhEZ0wlq/VmHa5Y/Lm3RCi/7xPm+Pq8wA== X-Received: by 2002:a05:620a:45a7:b0:78d:5d86:ee3a with SMTP id bp39-20020a05620a45a700b0078d5d86ee3amr2694110qkb.27.1713520178140; Fri, 19 Apr 2024 02:49:38 -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 dt14-20020a05620a478e00b0078d735ca917sm1434532qkb.123.2024.04.19.02.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:37 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:48:02 +0000 Subject: [PATCH v2 16/26] media: au0828: Use min macro MIME-Version: 1.0 Message-Id: <20240419-fix-cocci-v2-16-2119e692309c@chromium.org> References: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> In-Reply-To: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , 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 , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_024939_609714_232650DF X-CRM114-Status: GOOD ( 11.77 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Simplifies the code. Found by cocci: drivers/media/usb/au0828/au0828-video.c:605:11-12: WARNING opportunity for min() Signed-off-by: Ricardo Ribalda --- drivers/media/usb/au0828/au0828-video.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index fd9fc43d47e0..2ec49ea479d5 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -602,10 +602,7 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) vbi_field_size = dev->vbi_width * dev->vbi_height * 2; if (dev->vbi_read < vbi_field_size) { remain = vbi_field_size - dev->vbi_read; - if (len < remain) - lencopy = len; - else - lencopy = remain; + lencopy = umin(len, remain); if (vbi_buf != NULL) au0828_copy_vbi(dev, vbi_dma_q, vbi_buf, p,