* [PATCH] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors
@ 2025-11-23 16:35 Haotian Zhang
2025-11-24 13:14 ` Geert Uytterhoeven
2025-11-29 12:43 ` Miquel Raynal
0 siblings, 2 replies; 3+ messages in thread
From: Haotian Zhang @ 2025-11-23 16:35 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr
Cc: linux-mtd, linux-renesas-soc, linux-kernel, Haotian Zhang
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@iscas.ac.cn>
---
drivers/mtd/nand/raw/renesas-nand-controller.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/renesas-nand-controller.c b/drivers/mtd/nand/raw/renesas-nand-controller.c
index ac8c1b80d7be..c97fa3e62837 100644
--- 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;
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0)
return ret;
--
2.50.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors
2025-11-23 16:35 [PATCH] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors Haotian Zhang
@ 2025-11-24 13:14 ` Geert Uytterhoeven
2025-11-29 12:43 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2025-11-24 13:14 UTC (permalink / raw)
To: Haotian Zhang
Cc: miquel.raynal, richard, vigneshr, linux-mtd, linux-renesas-soc,
linux-kernel
Hi Haotian,
On Sun, 23 Nov 2025 at 17:36, Haotian Zhang <vulab@iscas.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@iscas.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@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors
2025-11-23 16:35 [PATCH] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors Haotian Zhang
2025-11-24 13:14 ` Geert Uytterhoeven
@ 2025-11-29 12:43 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-11-29 12:43 UTC (permalink / raw)
To: richard, vigneshr, Haotian Zhang
Cc: Miquel Raynal, linux-mtd, linux-renesas-soc, linux-kernel
On Mon, 24 Nov 2025 00:35:51 +0800, Haotian Zhang 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.
>
> [...]
Applied to nand/next after fixing the spacing, thanks!
[1/1] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors
commit: a3623e1ae1ed6be4d49b2ccb9996a9d2b65c1828
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-29 12:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-23 16:35 [PATCH] mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors Haotian Zhang
2025-11-24 13:14 ` Geert Uytterhoeven
2025-11-29 12:43 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).