mbox series

[v2,0/3] media: static-analyzers: Fix 6.12-rc1 cocci warnings

Message ID 20240927-cocci-6-12-v2-0-1c6ad931959b@chromium.org
Headers show
Series media: static-analyzers: Fix 6.12-rc1 cocci warnings | expand

Message

Ricardo Ribalda Sept. 27, 2024, 10:02 a.m. UTC
This patchset introduces fixes for all the new warnings introduced in
Linux 6.12-rc1

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Changes in v2: Thanks Andy and Hans
- Replace max with if
- Fix style in subject
- Link to v1: https://lore.kernel.org/r/20240927-cocci-6-12-v1-0-a318d4e6a19d@chromium.org

---
Ricardo Ribalda (3):
      media: ti: cal: Use str_up_down()
      staging: media: ipu3: Use str_down_up()
      media: atomisp: Use max() macros

 drivers/media/platform/ti/cal/cal-camerarx.c    | 2 +-
 drivers/staging/media/atomisp/pci/sh_css_frac.h | 6 ++++--
 drivers/staging/media/ipu3/ipu3-css.c           | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)
---
base-commit: 075dbe9f6e3c21596c5245826a4ee1f1c1676eb8
change-id: 20240927-cocci-6-12-4c571bc8e9dd

Best regards,

Comments

Hans Verkuil Sept. 27, 2024, 10:09 a.m. UTC | #1
On 27/09/2024 12:02, Ricardo Ribalda wrote:
> The max() macro produce nicer code and also fixes the following cocci
> errors:
> 
> 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()

Subject and commit message is now out of sync with the code.

Hans

> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  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);
>  }
>
Dan Carpenter Sept. 27, 2024, 10:10 a.m. UTC | #2
The commit message doesn't make sense.  Please, wait for a day before resending
patches.  There is no rush.

regards,
dan carpenter
Andy Shevchenko Sept. 27, 2024, 10:43 a.m. UTC | #3
On Fri, Sep 27, 2024 at 1:16 PM Ricardo Ribalda <ribalda@chromium.org> wrote:
> On Fri, 27 Sept 2024 at 12:10, Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Fri, Sep 27, 2024 at 1:02 PM Ricardo Ribalda <ribalda@chromium.org> wrote:

...

> > >         if (i == 10)
> > >                 phy_err(phy, "Failed to power %s complexio\n",
> > > -                       enable ? "up" : "down");
> > > +                       str_up_down(enable);
> >
> > You never tested this, do not bother to send untested material, please!
>
> Do you mean tested in real hardware or compile test it?

Obviously both as one can't be done without the other.