From patchwork Mon Apr 29 15:04:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13647211 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 D50FCC4345F for ; Mon, 29 Apr 2024 15:11:11 +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=TB8gbFyw6dlMHFQc45QyGRUBXy4IbY/49ARNT2BUYko=; b=vyksizYDwJX218 WBwqeEN9TxYcChiqopo/emI5YGjFInMmuGFRFQEP6ofNezSwkBPb7/Ss8pCMTUrt+EHxsD1SDM0v3 provo/eyKoWMvPOArriiAFvNLr9wCF2F5z4G104fRR2bVsOnfUf2Cc0rwAVCWP/CsVrk1eD1/jmIf OSiCR42KGXPYKWm9BgssjImi+PyzDbeqN2D8ZTKe68D81oIF1EELH4hGT8Cs2vkUjZiKa9jahn20O f1ZzqUUY/Jju/rHGwzo353OFKnUTCq7rzT2wuO9Fcj8GeGHJBZVhaaWKVCKDRy4QseGIqGxn0WSBG Vb6p4HY8tI1W/V+Dc06w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Sec-00000003JRC-14O8; Mon, 29 Apr 2024 15:10:54 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SaG-00000003GFq-2Neq for linux-arm-kernel@bombadil.infradead.org; Mon, 29 Apr 2024 15:06:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Cc:To:In-Reply-To:References:Message-Id :Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender :Reply-To:Content-ID:Content-Description; bh=WOR8+WeMkxm0czNaQrlO8zy4rfkYFKnx5dqFso5t3cA=; b=ZFT17MzjFfALZXbPGDLKWNimfi Og0gLOEOpKvk5sTN5T5QnhwZ9vhkmjCXZnpQEO6xiWfmX1FDzOts91IElpppZE3Ir2ScPGd96/A6b 21NRahsha3TvbJ2YLRO1uwPjcOYbOnc/Wcs8soSJ/UZAUKH4/I0zPzgMm5qTe/EV5sfBSbSA5eUdd CV0nUj32HPR0fs6J4TUj1A8G6C9gHnYlbZi7rVVw3bi66vFSmqRlGI69IzsuXCTPJ4X4nQ85L6FUG vMCyetJ9fGy0d9Xa2mZOW/KEI9zGUq9Tkyog+ggyOiHjn34i8p8YWvnvskh2z83tzQCI7mm8WdUMY lwbG3idg==; Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SaC-0000000CfmZ-0bMi for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 15:06:23 +0000 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-78ef9ce897bso314509285a.0 for ; Mon, 29 Apr 2024 08:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714403102; x=1715007902; 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=WOR8+WeMkxm0czNaQrlO8zy4rfkYFKnx5dqFso5t3cA=; b=XiNH0pF829ceGkTdYZhF0Z9HaXc+MeVmGLSlDuqpXLmQPZHNAfgLZh803aLpKnj6s0 bKO8t9NPJyFxgHaXtklIvYA2HsEg7wEKBqhG9F7hvHgs2Xa6auhemGrvuks2SxlWMssV x7yl6iNIn+6TtdRnLhlDAeNlvQSF0KCo7yfLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403102; x=1715007902; 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=WOR8+WeMkxm0czNaQrlO8zy4rfkYFKnx5dqFso5t3cA=; b=rbtgoJnL64roj4mNUjaUCph3eNjj56Ocy3H7KbmlgOVzWh4wimqGaLRatlmSZLxhOV qch8OFPW6/vP4iuw8VzfgK8nXLKYeIQaUdW9Z+ldddrmFUgAe8TtF1wP7NI0K8FmFKZL 9Oz+PoaJ3KODwSe6KcfEvIUTXW0N/zwgDK0Dh2RsPL1z3lNkco0onYwpHOUMZU6oj6NK dUH5VIYGdE4KAKHSnsEM88g6jBvk08JGFY3G5KxvID7PXBvc5Lw8i3tejoPgBSt3cNbg qo92Yf+qHERHvkCG4aihv2LLzdn5cfA2W0w9/ilf3MQ/zsPqmnKlVct2ubkI3mfeRcRb PJqA== X-Forwarded-Encrypted: i=1; AJvYcCU04EPJVGvCnhoVo5bhLDY6dd18r8NH5NhuSzxrHLCVHM6JbAqwL+qCnVHjX766wDyrc20BM9tpYO58SYrKmeramLaeXHsnO/ANGp6CSlOsmLZfgLA= X-Gm-Message-State: AOJu0YxjRgiPvDmSWTOcPzd147vdIb5xWfO0j01JBZxdwy4NGgnwlUAn p+/SPc/JAVbk6UL9GSbk6gIKvHnCZBdJv44ehMtdxmdeXyGE/GKTOQ8ypx8qJA== X-Google-Smtp-Source: AGHT+IFvqATO8BLnIi9vdu5lMT65HlpTVBjzYUMzQ45Qpvw3JFM44+jkXB+KR4H073WWP4wnEfgBGQ== X-Received: by 2002:a05:620a:70d9:b0:790:ac08:8d4d with SMTP id vk25-20020a05620a70d900b00790ac088d4dmr11390058qkn.57.1714403102367; Mon, 29 Apr 2024 08:05:02 -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 p7-20020a05620a056700b0078d3b9139edsm10568591qkp.97.2024.04.29.08.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:05:02 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:04:58 +0000 Subject: [PATCH v3 19/26] media: stk1160: Use min macro MIME-Version: 1.0 Message-Id: <20240429-fix-cocci-v3-19-3c4865f5a4b0@chromium.org> References: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> In-Reply-To: <20240429-fix-cocci-v3-0-3c4865f5a4b0@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-20240429_160620_265545_43251A4E X-CRM114-Status: GOOD ( 12.84 ) 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 Instead of a custom min() implementation, use the real macro. Mitigates the following cocci WARNINGs: 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() Reviewed-by: Bryan O'Donoghue 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 e79c45db60ab..9cbd957ecc90 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. @@ -178,10 +175,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.