Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp522201lqt; Fri, 19 Apr 2024 02:56:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW520mnpin/D8VZJO4SeJsx0bR2GgVoogzC2VMawxPwIAxx9o7ktrEQEYYoTIux8TIEHwBRx9JYjwnmHAzY4fmW1K5n9ur6mV2/UMforA== X-Google-Smtp-Source: AGHT+IFAV07edqoWkrYS3/hJtMY+AV0iqIz4/S3hdkCUD8S/LWY2FJCHVUg8Qvutxs1ZjviONp6f X-Received: by 2002:a17:902:e543:b0:1e5:5c8c:67ec with SMTP id n3-20020a170902e54300b001e55c8c67ecmr2057891plf.5.1713520585713; Fri, 19 Apr 2024 02:56:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713520585; cv=pass; d=google.com; s=arc-20160816; b=ByrgvJs52ScNG91OHwRu6vWCHHqb0W3vX2lnQnXjzp+3PlfCuE2kRqu5kXIyNgAxzj G1b+19WovNPuy3WTnJrkfXozj+yggUKF6sQxZt5gO8bcPYMY34NP2rzpzTAuTIWWkSUB ZYY00JPCS9kst3buNyZd1dBIb8+0BH6KCfJ9ib6x3fRUV3XGnc/rl41u1XGaYgWGkUxI 7Ik/p23DBleWm6TWR4vNLElCvRZxtcdE+XIb0UF8TgrcZDKGbtH0/DHu7IlnrN8gt0bK A6S8WlPrcUr1nkpBLo9K1Q/AfvGpnFIQQbYm+/kQkUd5esnhOE+Z4sqm51Z1mR2fY2CN 8mIg== 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=hYOJzUnpv9q2D47VjlP9TkFSb49icqGz0TC7JGSn6z0=; fh=kH8oTwcJxOKVdOuFYmlngSm7vI29Py2CulrtKD9T5Vw=; b=gfi9gzQZ+wtSdl9wgnUnZsWsgRG11NVMBJFEulcIQ2qj02o07UPxgt9t43Z08owY0n e2H9HgohlGK5jj3057PnUZ69OdkiKhDfC3lmgb35AxXyMocpDENKcjhUinx3GltnYpdL J5/XOIJ74eqM8r7kz7+3MY9GPK2XNMcr0u3v0HH7tbENweRSs0Hvlnfm4a7iAtoejRJF Iflhq1ZdehM5aDUMa6Xq3zony9LhN8uinK+XioK5KEcG110AOZwPsUlOgkoFztpb1aTG UM+aDWr0P9NrAYf78eG6I1ILwvKOzFP0/nWZ4bGAnbbIoD749yWaPh1ExQP5Jj3uWOwQ CuOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZJFVxKSX; 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-151266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p3-20020a170902bd0300b001e7a854b118si2959925pls.338.2024.04.19.02.56.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZJFVxKSX; 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-151266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151266-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 27A5CB22D4E for ; Fri, 19 Apr 2024 09:55:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A54CF12DDB5; Fri, 19 Apr 2024 09:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZJFVxKSX" Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (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 44D2512EBEA for ; Fri, 19 Apr 2024 09:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520184; cv=none; b=IlNK8zdUgCf/Xwzot7df2Ou+iAtZzrI789CMo0Ca8fVEcQkUQjTgJ/vvgnbPsatLYH42eBJouIlfoPb/vnlm1Jq8ZEw0WPvYOfe8yaq4IOwywdYHXlOpNi17i0qHN7jGdHytRjzv2GnYdULE/ZiJ8sd0pMgURQY89NtHBT1CfZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520184; c=relaxed/simple; bh=b7575egpMtje3XxHm3TKUIbqmP2kiwLFL5J+QhZ2HHc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C/AHXIhBYBSKzr3R0GB7A4dfTPuR2XPIkV/+3uWILfbXvHt6yPRP+jff4mA+nEXbzuNf3aZob5OpIZa0Jz6CS70ZiWPDbFmL+A3hdnZ2Nbbryg034PpnrAA0fVVZihVAPhNtuTH8pDb6G0YqqSZFjHCkzzzjHBRO6ks/S18VXvI= 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=ZJFVxKSX; arc=none smtp.client-ip=209.85.167.180 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-oi1-f180.google.com with SMTP id 5614622812f47-3c6f6c5bc37so973274b6e.1 for ; Fri, 19 Apr 2024 02:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520181; x=1714124981; 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=hYOJzUnpv9q2D47VjlP9TkFSb49icqGz0TC7JGSn6z0=; b=ZJFVxKSX8eoV6cYNRP+b+5IGt6mvMt/G8+Pls6/zbV0WGGCNY1repwFbcFQw0dLQsS A6fvjqQsIzsQ6ZpYZ38CCC0aHsyieNzv0hmT88v02df7DnXH+uZTGOxj16fjiqR3XHeH p3WeXy5+/ImHJUN26tCUj0CDuRxAhf6vajQYw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520181; x=1714124981; 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=hYOJzUnpv9q2D47VjlP9TkFSb49icqGz0TC7JGSn6z0=; b=HG6dRgBpa+u9kBR+FoSDhh1aBBYjxrjJCPig+oVgh8Q/DvB83nsbpBZmRdGAQbQ0rF Vylb9/B39IpthQkQvuQQtMpKXWhYeE+XYO2bn6nuiZ4uP2mrHT9VVb4O0iNSmKkYXwC0 cOsLzlRyyqNZDiPhNxk5wkiMP2vLokWJ4C7mJ00bFJDYi2XC5q3hwMRFKydBeqxIHtbZ ClZTmV/3n0xdyZrSUj5BF5JwM1U7XID4xlFE3TfNB52JAmj0rWllp0x+BJxyd9abg/tc 9HWEENFKP6GicFKV1nv986jtyVKfYmV+SefjtgigHpw9GjAIrTD0ec1zwfdD3yxzCmY4 7PJg== X-Forwarded-Encrypted: i=1; AJvYcCW4Vucz+wP2AzmyCAXf8WHark/Rj3EUiPhitUuVPyrvI5HBWFKSWTlJoOTQ+OdmIJAUZ2pd1Zv+Y3KFW/r9wTwB6i08wGxIS04akFcI X-Gm-Message-State: AOJu0Yy3u8LUQQaIY7FZAEdlbZdT12tX6QNpX5W8TlQOFKY3/DKfwHTZ LLNZnRppJBniS4+XtLto7240phnG7J/fCSnb16B4monblzDhgmiU/xhp2Y+7uA== X-Received: by 2002:a05:6808:2029:b0:3c7:2eff:7dec with SMTP id q41-20020a056808202900b003c72eff7decmr2132218oiw.2.1713520181341; Fri, 19 Apr 2024 02:49:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:40 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:48:05 +0000 Subject: [PATCH v2 19/26] 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: <20240419-fix-cocci-v2-19-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 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.769.g3c40516874-goog