From patchwork Mon Apr 15 19:34:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13630646 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 4FC0BC04FFE for ; Mon, 15 Apr 2024 19:40:03 +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=diSs6PjrZWNfVSFXwepvrcOnwBCEIA+9LlvUuQJC7Cc=; b=4ycXwUeSEucYmO IgXr6zcKi4TMb78F3rOmwxuVZp/iB+TQvxmY2/zkVSNrUqadpWIl4vHSvfyrPP/8ZSmKUwWnMEsRH n5nwUz4VBeb/QoIyedOrb3P9DVEVOFWh2P1auXP7+n3QRJZ7K4QTuIhTi41XXQPaUBBs+Hejv7War WScH8QKEwZjirVfRMJGtRo13kUXTm9/I6AvIpMtfSzPNXahpOzMCgbzljdP5xYOkYdb7Ze8lP0rZY iCKOPeL4HRGBdLsSleVg07etkFoacn/kwRk6jCoo63bQpcVtWO3svVVfFCgCWCdU12S9tAjg8VEas CGkKKFjoJdCylLqyuGQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwSBE-00000009f5u-0yrE; Mon, 15 Apr 2024 19:39:52 +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 1rwS6T-00000009cC1-3y4E for linux-arm-kernel@bombadil.infradead.org; Mon, 15 Apr 2024 19:34:58 +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=VH1TTY2R78PVfXYnT8sQaYwvCkEpO00JMLA8gBHoObU=; b=eweKQoLFEyIcZM+danETyyF95G 6hIhe/yhfBCAXshvfXhbH3oUBMgZCTTSjXOs37xAvShat2LqWMbS9ESjm0/7DbPI6TToRjoAwQvLK xubxs2YnBUAYFZl7xnWP7tEEG+5Kzb5bHALqntfLDarule93Gp2kYRGKl3JW+/x/1seGS7XVWxyAw CDdXiKBfVfJmIlp9XObUwry75vD72C8l40Fwz4SKtV3LZUckVeMG/8kRHMUzzWcP8L4/UiV2vZ+go es6ZzFkTWYaWW6uPZfFsG63JaSP2TbHcERdaBRnPMqyMdXt5dEf5CRAKVO/qrfs0rmEr6uvH2oqF5 e+gXJzlw==; Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwS6O-0000000GMtk-3OiV for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 19:34:56 +0000 Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-78ec78c4fceso238120085a.0 for ; Mon, 15 Apr 2024 12:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209687; x=1713814487; 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=VH1TTY2R78PVfXYnT8sQaYwvCkEpO00JMLA8gBHoObU=; b=WgzmjuLAFtTb66jKNBzJrF9TTALaud0mHJbDYsJPi2byS7/zc7IGOosO+2ts7WmpSn 9ntxW5gO2Nh03bkwQITozolmHqnevV6I1oZ1V7cOTUIGqb2JZ3TxEJA72zECFvmOtEJo IOfGgF/PlCO2X4Nn0k5G31LcAjHVszFPD34eY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713209687; x=1713814487; 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=VH1TTY2R78PVfXYnT8sQaYwvCkEpO00JMLA8gBHoObU=; b=OGEIpMzkV3HkKymuB/pbE2cKdBIEpil29zn4Fi7obUoDm/2XdacucvUu5Rd8uIoBYR nYwDaALLaUQmakN4Pr7Z02472xOEXcmQO2OE2VpojNWZiZGj1Do4gmdbCd5R5Fd9bX/Z 8Ppm7fQF853r3/zQrwmp3AC7p7KVtCJLr9/TWrVOAkSSN8t8sKlDry4L9sKKUR+QmN86 QE7bQTqfcbvSO/NJVGaFyGW9QvtcmmTpiPntAJ5lKV+D/ZnLge319NpLi5h9kXl8RKF6 anGo1+C5Qe+JjBX/lEtqOZTuHHWRgv8d8cbCz5TtYy/tuV7leV8g9pD0wTbZwJ0WkNnt v2Kg== X-Forwarded-Encrypted: i=1; AJvYcCX0i+EQTKdgVKpKvPL+9Kh8ZEm5ZiKFkiG6JwJ4j5tqkjaLpZyjy/j5YK/x3QUchW+zjs32Ohag+esGqFXTOavzhGwLPk0n7fWD254qZBLaxaXN7Jk= X-Gm-Message-State: AOJu0YzgoJbfD0lRmCbVycKruyQ/vBMwfH5ODYcPVE00oVniIrMK4X5V OFs2y+7bfwt/ATgvZ+k79NlBGGtdzRblLxNouTtLXbNpjlIRQuIEI2yCWHbaeg== X-Google-Smtp-Source: AGHT+IFZZwBtLZMDNfJayMBU/PaT+EdKNrIoBaFoYxfd58lYWJrbZu6cOvIxZ8QNIWMRuOhipLdFVA== X-Received: by 2002:a05:620a:2953:b0:78d:61fe:77c6 with SMTP id n19-20020a05620a295300b0078d61fe77c6mr1118634qkp.2.1713209687511; Mon, 15 Apr 2024 12:34:47 -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 s26-20020ae9f71a000000b0078d3b54eb76sm6718055qkg.78.2024.04.15.12.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:34:47 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 19:34:34 +0000 Subject: [PATCH 17/35] media: flexcop-usb: Use min macro MIME-Version: 1.0 Message-Id: <20240415-fix-cocci-v1-17-477afb23728b@chromium.org> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> In-Reply-To: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hans Verkuil , 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 , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= , Pavel Machek 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-20240415_203452_917837_5B4C4F07 X-CRM114-Status: GOOD ( 10.36 ) 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));