From patchwork Fri Apr 19 09:48:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13636062 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 13DDAC4345F for ; Fri, 19 Apr 2024 09:51:37 +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=RdnUnn1DqeDKn9S0llfgkh7xlSlzwoStITrFN5mfIsM=; b=DBDllToi2u+RnZ VtxtJHVEU0xmc7VlNIRnrgyt4qKZXMSGfhWu3LegT5XhRc0SC31Ml1OT5U1K3BZjl5h7162sTRVPW rXnALd51H7ZakzBXsdALz5OfbIdLQ8lkYw9SCI1zNZxUxkhxl6FRafbAX7Vkpj6BcoQ7WH80dqWSc fnb/nNRybHmJZO30IkAjk8ZEGajAA85HyJpukEP1ALGEwTlKGALtAHXhH4fAhBUTGl3KtlXuRoMME Fah5vGipX2wzU8O9Vn7C+qzkPGraMLfnBolxQWtMAHtSKMRJ0+1PQqwCbzS4ItpNzKEygdH+YT3Gl 4fNmNnUH/kGGeD8NVsKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxktw-00000005A4c-2yUL; Fri, 19 Apr 2024 09:51:24 +0000 Received: from mail-qk1-f182.google.com ([209.85.222.182]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksF-0000000590H-1wnK for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:49:47 +0000 Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-78f04581a66so114768485a.2 for ; Fri, 19 Apr 2024 02:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520177; x=1714124977; 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=oXXgUMwvGuh/bAZ05Vu9f2lIZUwmSZiJ1Ue2E9QmyGE=; b=AeLQb+7yroz1N85IaLBmgCrfbdpcP3/Kr6zRrTzmvckfHbqn0C1akBhveY2xRW8Eu4 bkG8sdLpAkU3nsJVUm8+DgPEASzHeDFPD/hAdivBNdcE9lRG0nDfprPfHzGTQx2FWJxM OpErqOFz61QcMdnjV75WKnwp8jWGDvF7oX4NE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520177; x=1714124977; 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=oXXgUMwvGuh/bAZ05Vu9f2lIZUwmSZiJ1Ue2E9QmyGE=; b=ka+Kvyehn6+gVE2J4lzCuouApo9zp4uAV+kjd/WZWbDTAInCITJCzt19PuNwnaV+vi 7BmStE67fbxG43XVjkCjXWPi5HpTimgGXM0/100/8Geo5dXLPhd8Xgyx0Vy+oUKVnpir SKsSap03KAsk/NLT7H8/Ub1Q4f76/mJpcjGs6A6mEKUJ6gOTJVQJSXhyTOQE+zxWJian XE1qJ8jnNGJ4Rgbi3kf0TzpiasGvp39aHzvjuEk3z/Mfnm7LeryK2I72+WVO1oaUn2Y3 EhaECg0Y0DrHdkbEGuMaPPyS11yYBVJYG6Sqt/ZcLwrTsepObede1XHIiUhN1nmWIQ5q TStQ== X-Forwarded-Encrypted: i=1; AJvYcCWIN8fBHw7VDfKtOWuqZcgEzX/64OKEV12m+NP+vjspVZtq+wWXVKvk8V9ZlXd/EQB3XUlfkQ8HesRCTdx38/W16DhyAqp9QcItuGO8sdBPY4KVbS4= X-Gm-Message-State: AOJu0YyGCxtCxLT8Gk9V8zizAfU6pAzKi2Pk+YwIHEGqEre7hN+Otmed yW3Im3rtd8jdrZ1v12cahf0TiQrgYkO4Jm83rggBD7Q8S1s7W1QN+qkUVp9QHA== X-Google-Smtp-Source: AGHT+IHtaefRUDCkJpXsh07H2yA2NeK9gO3xvd3htQb2Rtwe8WSp0MnWmceFe0R4rsJzjkJBUbtDcw== X-Received: by 2002:a05:620a:111a:b0:78b:e8b0:f156 with SMTP id o26-20020a05620a111a00b0078be8b0f156mr1546954qkk.67.1713520176717; Fri, 19 Apr 2024 02:49:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:36 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:48:01 +0000 Subject: [PATCH v2 15/26] media: netup_unidvb: Use min macro MIME-Version: 1.0 Message-Id: <20240419-fix-cocci-v2-15-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_885489_97AA377D X-CRM114-Status: GOOD ( 12.85 ) 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 Simplify the code. Found by cocci: drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:138:26-27: WARNING opportunity for min() Signed-off-by: Ricardo Ribalda --- drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c index 46676f2c89c7..1c885d620b75 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c @@ -135,7 +135,7 @@ static void netup_i2c_fifo_tx(struct netup_i2c *i2c) (readw(&i2c->regs->tx_fifo.stat_ctrl) & 0x3f); u32 msg_length = i2c->msg->len - i2c->xmit_size; - msg_length = (msg_length < fifo_space ? msg_length : fifo_space); + msg_length = min(msg_length, fifo_space); while (msg_length--) { data = i2c->msg->buf[i2c->xmit_size++]; writeb(data, &i2c->regs->tx_fifo.data8);