[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdUP+8ZWsTP-PHBOuNSTL7jeRHsXwf5Gg21vHL1=St-cxQ@mail.gmail.com>
Date: Mon, 24 Nov 2025 14:14:05 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Haotian Zhang <vulab@...as.ac.cn>
Cc: miquel.raynal@...tlin.com, richard@....at, vigneshr@...com,
linux-mtd@...ts.infradead.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors
Hi Haotian,
On Sun, 23 Nov 2025 at 17:36, Haotian Zhang <vulab@...as.ac.cn> wrote:
> devm_pm_runtime_enable() can fail due to memory allocation failures.
> The current code ignores its return value and proceeds with
> pm_runtime_resume_and_get(), which may operate on incorrectly
> initialized runtime PM state.
>
> Check the return value of devm_pm_runtime_enable() and return the
> error code if it fails.
>
> Fixes: 6a2277a0ebe7 ("mtd: rawnand: renesas: Use runtime PM instead of the raw clock API")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
Thanks for your patch!
> --- a/drivers/mtd/nand/raw/renesas-nand-controller.c
> +++ b/drivers/mtd/nand/raw/renesas-nand-controller.c
> @@ -1336,7 +1336,9 @@ static int rnandc_probe(struct platform_device *pdev)
> if (IS_ERR(rnandc->regs))
> return PTR_ERR(rnandc->regs);
>
> - devm_pm_runtime_enable(&pdev->dev);
> + ret = devm_pm_runtime_enable(&pdev->dev);
> + if (ret)
> + return ret;
Perhaps insert a blank line here?
> ret = pm_runtime_resume_and_get(&pdev->dev);
> if (ret < 0)
> return ret;
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists