From patchwork Mon Apr 29 15:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13647207 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 415F8C4345F for ; Mon, 29 Apr 2024 15:10:46 +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=dB7Mm8RhuRiF66Qef6NQNwKHcZF9fbGAEaZeZLTx+Fs=; b=kZt3y2iIWOjbvX uzP5JT4ZqRu83GxEbTaAwWO59J0HbS7MC7sne2H2Wfch4DUM67vm8eXh4nUpQo79ejiguWcizvlzy 8q+5/3nrRmR1CrfPGHyyQXsvVRzWe+krvb2hCSvflvdYPuKIqF+cPsGGxGyCX1tSdFfHj3K2up1yF vE6NDGyQf+uVpm3EIszC0XrNQwnElLbqeTCquBf7Qs+gnv6DofOc9vF2n8Eo9sh+olzoDpfuw63yn USJJ/4Ue97S1dfVQeONsYDuYGzUMdPo0VmhGRMfc+i6ualn087MvwpJbp38lkwhjpfjpJhSAwTawg 2BkTMeopFyBjdW4DCSxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SeC-00000003J3K-1aSj; Mon, 29 Apr 2024 15:10:28 +0000 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SYs-00000003FRm-36ps for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 15:05:01 +0000 Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-78edc3ad5fdso398183185a.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=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=B7WgC2+IPrCSABKNTDoDmq5evIyXV522VQOG0leEbcc=; b=dnJW1qZsDLKjRTuxn/jO/Kqc0Bb6SBxFksMIpsruwTfkctpuBVo7Qw6XnCS/JuajDo Et7iEU2zZGWisTcEUlti8Dcbr1AVhgDDLwZU0PCnxGgPBzNz/9OHhr8irnnMHoju+ZvG fx6reGdaVV1ftuOxHiO8oHvq2SmMk3wxprsE4= 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=bZOnJxdp+czQN68qURD0++XPyyk4opFDrhE2Q+t6gluGRPeuAHoGJBXC1UQ1Kg5KXs eFG7zkfAMrCIqHMjEssemX1fmjQ3OU3Ak4m7/WnRow+n91R9V7ePAsXe1/xuc0TUs0d8 Ibc+fKxIKz8I44388zIdFFsdvUhER3eoks1oGlRO32UVsE2wZ8X0q8pXzjBt3qQxDSJ/ 5tLHjHeLomdh7iyNAJn//QhhQDfC5S5zPySDNHVJWtyM5KXJ4B0karhLcggpCkFEMPlL 2O7Fr85KJSZWzh7U0HG+ccLx+mQIJgyUx9JGYFnpnst3DnA9p1U8eQj1yHpiyRPQnsA8 qTbQ== X-Forwarded-Encrypted: i=1; AJvYcCUSfMvroHhv9praI0QoDuPUM+l65Y1+ii3HftAkLqh2CGZT5jmEtH+l7QRdbzQvZEmTNAjasSjCQ/fMeawhJEg/zdPnMHvn9FGlnNb+CHm5aSU4WtY= X-Gm-Message-State: AOJu0Yw6kVFBNqfkhFHjvjOjCgBvY1/xSGhSqGRqWDStopfFIliFt6dN WVY8svCSNLo1IZO2lvk9AuUlut20ra2huXvScHzB0/3oAg4S2oHRTscLijW8qA== X-Google-Smtp-Source: AGHT+IF5XTR9AvencoZ/44RX25g9bUhd0pibp8Bru1gSUBx9gDRO27bIj/oJhNJSOtkZAwqzS5pcnA== 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 MIME-Version: 1.0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_080459_114390_DA7D42E8 X-CRM114-Status: GOOD ( 12.73 ) 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 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 */