[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240418105433.GW12561@pendragon.ideasonboard.com>
Date: Thu, 18 Apr 2024 13:54:33 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Ricardo Ribalda <ribalda@...omium.org>
Cc: Martin Tuma <martin.tuma@...iteqautomotive.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Hugues Fruchet <hugues.fruchet@...s.st.com>,
Alain Volmat <alain.volmat@...s.st.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Sowjanya Komatineni <skomatineni@...dia.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Hans Verkuil <hverkuil@...all.nl>, Sergey Kozlov <serjk@...up.ru>,
Abylay Ospan <aospan@...up.ru>,
Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
Dmitry Osipenko <digetx@...il.com>,
Stanimir Varbanov <stanimir.k.varbanov@...il.com>,
Vikash Garodia <quic_vgarodia@...cinc.com>,
Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Benjamin Mugnier <benjamin.mugnier@...s.st.com>,
Sylvain Petinot <sylvain.petinot@...s.st.com>,
Jacopo Mondi <jacopo+renesas@...ndi.org>,
Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Niklas Söderlund <niklas.soderlund+renesas@...natech.se>,
Pavel Machek <pavel@....cz>, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-staging@...ts.linux.dev,
linux-sunxi@...ts.linux.dev, linux-tegra@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH 04/35] media: uvcvideo: Use max() macro
On Mon, Apr 15, 2024 at 07:34:21PM +0000, Ricardo Ribalda wrote:
> It makes the code slightly more clear and makes cocci incredibly happy:
>
> drivers/media/usb/uvc/uvc_ctrl.c:839:22-23: WARNING opportunity for max()
>
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index a4a987913430..4b685f883e4d 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -836,7 +836,7 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping,
> while (1) {
> u8 byte = *data & mask;
> value |= offset > 0 ? (byte >> offset) : (byte << (-offset));
> - bits -= 8 - (offset > 0 ? offset : 0);
> + bits -= 8 - max(offset, 0);
I don't think this really improve readability.
> if (bits <= 0)
> break;
>
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists