[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7d8065fb-a040-4f79-9c46-07924f46b876@xs4all.nl>
Date: Mon, 30 Sep 2024 09:20:31 +0200
From: Hans Verkuil <hverkuil-cisco@...all.nl>
To: Ricardo Ribalda <ribalda@...omium.org>, Benoit Parrot <bparrot@...com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Bingbu Cao <bingbu.cao@...el.com>, Tianshu Qiu <tian.shu.qiu@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Hans de Goede <hdegoede@...hat.com>, Andy Shevchenko <andy@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: Re: [PATCH v3 3/3] media: atomisp: Replace ternary operator with if
On 28/09/2024 19:24, Ricardo Ribalda wrote:
> Replace the ternary operator with an if. In this case the code is more
> clear and also fixes the following cocci warnings:
>
> drivers/staging/media/atomisp/pci/sh_css_frac.h:40:17-18: WARNING opportunity for max()
> drivers/staging/media/atomisp/pci/sh_css_frac.h:50:17-18: WARNING opportunity for max()
>
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
Acked-by: Hans Verkuil <hverkuil-cisco@...all.nl>
> ---
> drivers/staging/media/atomisp/pci/sh_css_frac.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/sh_css_frac.h b/drivers/staging/media/atomisp/pci/sh_css_frac.h
> index 8ba65161f7a9..3191d2858f59 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css_frac.h
> +++ b/drivers/staging/media/atomisp/pci/sh_css_frac.h
> @@ -37,7 +37,8 @@ static inline int sDIGIT_FITTING(int v, int a, int b)
> int fit_shift = sFRACTION_BITS_FITTING(a) - b;
>
> v >>= sSHIFT;
> - v >>= fit_shift > 0 ? fit_shift : 0;
> + if (fit_shift > 0)
> + v >>= fit_shift;
>
> return clamp_t(int, v, sISP_VAL_MIN, sISP_VAL_MAX);
> }
> @@ -47,7 +48,8 @@ static inline unsigned int uDIGIT_FITTING(unsigned int v, int a, int b)
> int fit_shift = uFRACTION_BITS_FITTING(a) - b;
>
> v >>= uSHIFT;
> - v >>= fit_shift > 0 ? fit_shift : 0;
> + if (fit_shift > 0)
> + v >>= fit_shift;
>
> return clamp_t(unsigned int, v, uISP_VAL_MIN, uISP_VAL_MAX);
> }
>
Powered by blists - more mailing lists