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: 13630529 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (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 775DA15E5D6 for ; Mon, 15 Apr 2024 19:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209690; cv=none; b=NdeeYkxRyzbKs7b2v2cIhY58ruDGXl56WNuEU0ItPMUb/EEZddADkXiNKx3pzJjHc4NufRZb1Vlc4Ip7rTPlxNOus9fECpfCxL9Bl12+F14TxwLzEtSIP8A6PloE3PS+4HV76kOGBmg0Pp7WAHNRjJjDLqnDamuS2HAjT2ghIpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209690; c=relaxed/simple; bh=QMsjv+wettsGw23pqby6M5jpWOg9Tw4lhss0lX66IJI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jrxRFGboC0bpV1sa93a/hZAjVP+2JQhzpTLYFBg9auAAF2NkHLM2qyT1YLxvYoj9M2zBtJlJney/eWuFKIGrFCGRCPd8lAJF1+4YfbJfyL7Wo7Iq74bwogTIguh23ExNc7ibce7CX2Z1CefDO4tE+eKxY2+JyyQe2TaV8g9Cn0w= 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=Aw8PVAeS; arc=none smtp.client-ip=209.85.222.173 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Aw8PVAeS" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-78ec78c4fceso238120185a.0 for ; Mon, 15 Apr 2024 12:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209687; x=1713814487; 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=VH1TTY2R78PVfXYnT8sQaYwvCkEpO00JMLA8gBHoObU=; b=Aw8PVAeShZ4GKhUDYCsi2PsqSye237i9HPTPm5MU6c/HPaFPfsyJtQd89eZHNpm34a 383SVnae4OoILq4kG05YEdXY9ArcAK+nX+5Ku2mIY+EiO3aJDpQuTbjmNjkWlMwyTPQJ 6JDOEM/aiAPq5mgjy4d/Q3LEkvJKRx0KgKrMY= 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=pNwhppRSccWwGVVaiWWRltzzv35MqgQVbB+N99hPRsnsROt3if0c/qj/SBcBPT9qHp qWnu+jzzASoen/BYGoxOhy1nYmVOx9WTwWs2rTnaZc5R3BCTHqyP1TW+wJSs0BIvmxjf jejUwBCm7cPbGanlrIj/BJr/nEEwAjMnRHDENP6mvdVC4Sfq5YgwOxDVxrZHIzLa6hV9 vnztTEfje7/htdOaoCzekHA+vkLNxwd/KISUP/AIIfMhBltRLcYQLgK9d2vGvO4TsUU9 He3wGkCujpf/YADufvDrMjiAFs914zwhLQKJluefy+AOHJ1JOnPOY3bYX1K5RnB37rfT DG7w== X-Forwarded-Encrypted: i=1; AJvYcCXKsGaKma2rzRVzfbhigk9JPowA11NaEqJXTjAdEBxXUV7CDz4G/0fzJQyrKZwwDQjgIdS+OgJQhmq2ZmkU4Q2LiVY8PMW0vcCKtsadQQ== X-Gm-Message-State: AOJu0YxkFEFCV/E8xvZpiN09cCq2TR4cyRYHeqNGKGGMmIIUl3qK1HqW 09vtJnNKYLpVTlrqkdH2O7yIlB+AMHFIMMAXzpQNg7rigJOBSWMeJGCEfS/dHQ== 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 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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));