From patchwork Fri Apr 19 09:48:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13636061 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 2E4A2C04FF6 for ; Fri, 19 Apr 2024 09:51:22 +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=al61i6Fdz7CGdbkvRRWp58kiudLspOEssFHVMYauiTw=; b=1gnoi+3X5RPV33 YsGs1KR0qWTLEH9HhUpgSD0yx89B4BXs2VZusD0BCtIpihv02djHr/mBN4m4IOuUOuzQGubOtVWcZ qudJXUtkMysP2tVqQ2WrPRuO8JuKDOmPbjReX6Ofp/6Bt2QEDvsmxhlCwUGgb9/ilFXWcjtSzEULf CgQpVeCjpsHp0Yttyr1+feY7mAVD/2ETbf1JjM3BQJ8iyKWyxNUq1BIGcVPZB6wzMSPDR9ijzo+0x PDrPj7l3xZpAIwSMzfRleoeAdxwzuQ+Fq5W+6KIIqsvCgzc2NvbHqQDd0S5S5TtwgnInlFOW9Gzsp bI92+AliMnhDfEgOWUaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkte-000000059rJ-39nL; Fri, 19 Apr 2024 09:51:06 +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 1rxksK-0000000596Y-2C8W for linux-arm-kernel@bombadil.infradead.org; Fri, 19 Apr 2024 09:49:44 +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=ejR4SFor1DGbZO07N+L+RxXvAXTkN+sOOOYtcWWVXb0=; b=UKgB46AU5QKTbvT6wHKEbS4Zkv HkK5A2jtrRY9rgQfa9+3iZ5VDzUFcIovi9+wR/KxjtQtI0/Ny7UEzitayuvTMzg7fDMPLLnRw86kr a/k/+7zgsA9s52UlqWpYw8M+3NvyWssuhpS6bwRDnV13674gVydS/kg987YAVniA4MQ3haykvTF10 nPqWHTRB1OqlQr6uVEJnRl2+oyRVvWdXhTvBn4CNpicw5IqI29MowLTsotDxCTmEBUHdatjdAO9bB WQrNrnlG/bOUGMT0AQUzBEsvClVaKyImewz2rKmEBIw4L4JimrEI0iuurfpD7wEvhAsj0mn1SDE80 BBBfDdMw==; Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksH-00000007Ngd-04hs for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:49:43 +0000 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-78f043eaee9so106774585a.3 for ; Fri, 19 Apr 2024 02:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520179; x=1714124979; 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=ejR4SFor1DGbZO07N+L+RxXvAXTkN+sOOOYtcWWVXb0=; b=ggPO9ZX7KrSid0vexvetqKBolc5bHVG2VRSu3o7yhmS1CQRaxrKYLMYPNnuUjcW30a 3Yj7aFB4Ek162Av6XHwXTIHfRgp9HmutYqxT5YKvRgZZ+0gZDyXwWtc4daFv0p6v1VC9 zkXUQTi7g579wXne9XnzSFI+A1/xrinJ1ESqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520179; x=1714124979; 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=ejR4SFor1DGbZO07N+L+RxXvAXTkN+sOOOYtcWWVXb0=; b=xGFbLujGBjS54Yjj6g+46QmwHt7y/qZGBGtON8c7r+NxO6pgmSXAz2gcQ3iROpg/nI 2w/oGTnrqoC1mJvlv1Vxxzpq76bVWqtiDaHh5ywrD2P0fgHR2wmUKQYlMJtfD8h90kNF kbuDjrLRWtWJ9qvQ3hrOTR0X9AYWPGDCcqMP5LLRhK206p1YLYHcsgFPFyWpOjfTbpSk l28YCVZRU+VBmSH+YfXTC0QkG2d0PahZj6r7sKfiKMwNM63GNt/hn9g+/oZAqTT7nWud fNbDCCY7nJueNtfMdPbFi3lZse4F0qay2Mkj1em8mNEYqoItSw81aAqYx6G0juwTvryp iu5Q== X-Forwarded-Encrypted: i=1; AJvYcCUikThP7SqB18NnYntUcefoykAkUbAwBosABhqslTsFm0y2gAY+zue0Dkk14XdjiEu8BZerCda4VBnosWd2xImIkeqS/UDKEJomgiDe3Y2VhTCszsU= X-Gm-Message-State: AOJu0Yw+RY7kn4P5qTJdFpdgdjEOmLAFQJ+kvQHldmzxlIvecaNqvDXc 7Xb5IwWM62pz6DKVC6VxpOfx4MttQ1O4vcukztrF83RDLSwvChpruCOi5hUpKQ== X-Google-Smtp-Source: AGHT+IGpZ3ldVVwdiWjuIy5SwcAIMUaAxjtBaGve9bP2/gGFY6jCFymehsQebGC3Yx4JbEu/ovs54w== X-Received: by 2002:a05:620a:d94:b0:78e:fe1b:a601 with SMTP id q20-20020a05620a0d9400b0078efe1ba601mr2205140qkl.0.1713520179012; Fri, 19 Apr 2024 02:49:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:38 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:48:03 +0000 Subject: [PATCH v2 17/26] media: flexcop-usb: Use min macro MIME-Version: 1.0 Message-Id: <20240419-fix-cocci-v2-17-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_104941_473520_8188451F X-CRM114-Status: GOOD ( 10.37 ) 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/b2c2/flexcop-usb.c:201:8-9: WARNING opportunity for min() Signed-off-by: Ricardo Ribalda --- drivers/media/usb/b2c2/flexcop-usb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index 790787f0eba8..3ba6a5ed7167 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -197,10 +197,7 @@ static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb, return -EINVAL; } for (i = 0; i < len;) { - pagechunk = - wMax < bytes_left_to_read_on_page(addr, len) ? - wMax : - bytes_left_to_read_on_page(addr, len); + pagechunk = min(wMax, bytes_left_to_read_on_page(addr, len)); deb_info("%x\n", (addr & V8_MEMORY_PAGE_MASK) | (V8_MEMORY_EXTENDED*extended));