[PATCH 2/3] mtd: rawnand: denali: Remove always true test

Michael Nazzareno Trimarchi michael at amarulasolutions.com
Sun Aug 3 10:15:34 CEST 2025


Hi

On Fri, Aug 1, 2025 at 11:54 AM Andrew Goodbody <andrew.goodbody at linaro.org>
wrote:

> In denali_wait_for_irq the code will either return from inside the while
> loop or exit with time_left being 0. The following test for time_left
> being 0 is guranteed to be true so remove the test and the following
> unreachable code.
>
> This issue was found by Smatch.
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
> ---
>  drivers/mtd/nand/raw/denali.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
> index b2401116689..39cb641e0b3 100644
> --- a/drivers/mtd/nand/raw/denali.c
> +++ b/drivers/mtd/nand/raw/denali.c
> @@ -173,13 +173,9 @@ static uint32_t denali_wait_for_irq(struct
> denali_nand_info *denali,
>                 time_left--;
>         }
>
> -       if (!time_left) {
> -               dev_err(denali->dev, "timeout while waiting for irq
> 0x%x\n",
> -                       irq_mask);
> -               return 0;
> -       }
> -
> -       return denali->irq_status;
> +       dev_err(denali->dev, "timeout while waiting for irq 0x%x\n",
> +               irq_mask);
> +       return 0;
>  }
>
>
Reviewed-by: Michael Trimarchi <michael at amarulasolutions.com>


>  static uint32_t denali_check_irq(struct denali_nand_info *denali)
>
> --
> 2.39.5
>
>

-- 
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com


More information about the U-Boot mailing list