media: atomisp: Replace ternary operator with if
authorRicardo Ribalda <ribalda@chromium.org>
Sat, 28 Sep 2024 17:24:00 +0000 (17:24 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 16 Oct 2024 07:32:42 +0000 (09:32 +0200)
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@chromium.org>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/sh_css_frac.h

index 8ba65161f7a988d94947c07a55f3b49f0179a34b..3191d2858f59397176dc9366a58fde1ef0ec739a 100644 (file)
@@ -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);
 }