Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1442029lqa; Mon, 29 Apr 2024 08:32:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYqp7NIQuaSTxgr1Udq+vhfdomN9alzsbClzTQuhEdrXBSNGI3KEmByYypWb9rAD/wVELEtVVbH1EfrJH25+dM5rfbRqu59+P+Qnlq8g== X-Google-Smtp-Source: AGHT+IHEMhEEjPiaJQbB8dF6RkvrDqp+6ty4QgOhzi5Yf9QzIC7wUDhFRW7aN0PPnNpcRcQ9F/UA X-Received: by 2002:a05:6a20:9f86:b0:1ad:8f18:8625 with SMTP id mm6-20020a056a209f8600b001ad8f188625mr13344998pzb.28.1714404774830; Mon, 29 Apr 2024 08:32:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714404774; cv=pass; d=google.com; s=arc-20160816; b=WyU+XjbxcxFkCwJHPBpk3kYS0kJN7LihX/kPlQBA1qnzx9A+DToa6+trvvC+9/VLS0 5I0xHr3V45NMLfY1levhhgr9huSG+WgL4mJ1ARlHXXMvAIiZKH1jbgz0EAhO+L3howOo XJjDl9jbMf53Oas4YNDEXBjn/g9YEN8kViGRtBNvBZSZdpOB3yoEnqTd2QiF8JNzpFC3 RUoD7aGfW/XFYjjGTxIDJUGmcS5QJIq4+aM4envCIDeX0mkcQ+S+4CelvckboCO8xdtt tB8MFp5Yqtt4FXcZAlyLLpLz2T0hdSCBAuyMi0us6ELMv8txWCMJh6jHftHYMZ1RLhZY cYzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=B7WgC2+IPrCSABKNTDoDmq5evIyXV522VQOG0leEbcc=; fh=C8dAsMFgBJdr2AiTeDT6WfWa1O+ZRerjLBRwCYea6M0=; b=dOtzePxUynUmDk2squ0NYYmQk8eCtm2QeKzhD1A0YffiPR32k76fRaml0QsP5H33p0 mcDdDFqNj3FsAALUHWx/KLz7DRJxA1i6u1Fvmte5wfrOSQowknT7kmlYmxvluHgkBqYg sJSXArhlEqvPqMSd1WwPz4mKGICEnRb9UHkPLw2GdVENQIVGxbP1Fx7IAMJflNasi5m8 e1ye6gKYUkYUWrkyuBvJFeSeH0dqiq87KXNAY9AlSQtetSx4aeOidw5WA0Era8XMspcS saw9cejedtPFahee3lwkMp1X0FkBA+R8zSFN6YBGfhFxq8y7Xt8qIZBZxHIilHrriZGI 3a6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=D9T37vDA; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-162525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id r8-20020aa79ec8000000b006eab069cdc0si19833055pfq.160.2024.04.29.08.32.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:32:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=D9T37vDA; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-162525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C2EC1B207DE for ; Mon, 29 Apr 2024 15:09:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69DE58287F; Mon, 29 Apr 2024 15:05:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="D9T37vDA" Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 E3DB3127B75 for ; Mon, 29 Apr 2024 15:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403103; cv=none; b=IRTpfz2Jy+SvetAZPEo2tsKnk6uvkfxnavEBM0oVWywOR3ApLTNcA6pc+Ejp9T0kn1Qdpy0RGiMAgkZXx1aR4tTi74jIXMWC0nRYFgKteS2iVCzEH28QIvqLk+QqqRmq+b3ZVv4pgqG6K5h5rKwUlWraWlIKGpUmLjGgN8qm524= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403103; c=relaxed/simple; bh=eTwz8g9CAKdFfcMUb1pEl/K4JXk6NTjbKJcjx2VRsnQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GWaT7c8ZUvrSHq63enrUpl4NccM8Z3Wd2l8NRqX1sF2cJkTALNJdMvs9OmnhJ/7diLFm0TdS18Odc4nOUL54guZIRNghdQa8DLFLkobG3f00mihPhHbJkEcEnPr+Px5vF3r6ORJseypbpaRFXTYg5koorGOGm1sQEDNjRYPc6TM= 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=D9T37vDA; arc=none smtp.client-ip=209.85.222.174 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 Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-78edc3ad5fdso398183685a.0 for ; Mon, 29 Apr 2024 08:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714403097; x=1715007897; 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=B7WgC2+IPrCSABKNTDoDmq5evIyXV522VQOG0leEbcc=; b=D9T37vDAU6WAGHnBT7CqKH5yKp0yWtydKQ4le4V+5yl0/L3aF8vXdHW55+2xfAXGQE B/9W4t0GgFIVDCnl4mWJzoQbJ/Txi2lNUtIy5j9x/m+iEm77AXUafXSr8Vrca8uL3F3I ShcXturg8NSd6F1j0kdP78ddCZOyM3F9gLzEk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403097; x=1715007897; 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=B7WgC2+IPrCSABKNTDoDmq5evIyXV522VQOG0leEbcc=; b=QEqMRwHqXngHUx085vQmn4nXu4tsYnF/6JmimF124hRZvRRRD2acIjnJKlayCJWwiA t1BEVNSd9Pf4UxYIuuGDGzV3Yi1jZCFh/bU1IC5S6QQS3ybSCZOApNdjz419+tvIPzSX 4vVFAmSa8j5egwvLNtMnBUkVsn2Y3wf7Sm9Myb2uZ2bGfhJNf7MpWp9jmLWOxZFWOz2/ 76si6pmlXxEpQkqKpdT0lI752SRRyTn3En2aPvFw/NmiwNecT7S44JWsBqojFfpzVbQx d/Ozt2YaXsE5NXX+KA5W5XITc3FdyM4KYDB3tvBGHrepHNeqGcASaVNBAFtXPxB4g1f1 0Hqg== X-Forwarded-Encrypted: i=1; AJvYcCUM4zTiYIY7e3/WrDFwd5nmIrAIvd2Io5FphUdNjvjN9DNE4m0W2WGdvGEgv/lshs7G1GM9rmGQoSYHrvaBerDfBU5Zuipy3ruXOBpy X-Gm-Message-State: AOJu0YzCIGYWNXXy3wbT0bCPJscOX8IlfnZBFzSAngenAXM9Rbdh/gtv lDJCxwj29m8uEQtyzr0gigN/3urTLxzrZRvUT/GaNrnTMhEFxfYFXbDrULvyyg== X-Received: by 2002:a05:620a:29d4:b0:790:8656:8427 with SMTP id s20-20020a05620a29d400b0079086568427mr12321977qkp.7.1714403097437; Mon, 29 Apr 2024 08:04:57 -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.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:04:57 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:04:53 +0000 Subject: [PATCH v3 14/26] media: dvb-frontends: drx39xyj: Use min macro Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240429-fix-cocci-v3-14-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 Replace ternary assignments with min() to simplify and make the code more readable. Found by cocci: drivers/media/dvb-frontends/drx39xyj/drxj.c:1447:23-24: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1662:21-22: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1685:24-25: WARNING opportunity for min() Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda --- drivers/media/dvb-frontends/drx39xyj/drxj.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 1ef53754bc03..6fcaf07e1b82 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -1445,8 +1445,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, /* Read block from I2C **************************************************** */ do { - u16 todo = (datasize < DRXDAP_MAX_RCHUNKSIZE ? - datasize : DRXDAP_MAX_RCHUNKSIZE); + u16 todo = min(datasize, DRXDAP_MAX_RCHUNKSIZE); bufx = 0; @@ -1660,7 +1659,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, Address must be rewritten because HI is reset after data transport and expects an address. */ - todo = (block_size < datasize ? block_size : datasize); + todo = min(block_size, datasize); if (todo == 0) { u16 overhead_size_i2c_addr = 0; u16 data_block_size = 0; @@ -1682,9 +1681,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, first_err = st; } bufx = 0; - todo = - (data_block_size < - datasize ? data_block_size : datasize); + todo = min(data_block_size, datasize); } memcpy(&buf[bufx], data, todo); /* write (address if can do and) data */ -- 2.44.0.769.g3c40516874-goog