]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors
authorHaotian Zhang <vulab@iscas.ac.cn>
Sun, 23 Nov 2025 16:35:51 +0000 (00:35 +0800)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 28 Nov 2025 08:11:59 +0000 (09:11 +0100)
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>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/renesas-nand-controller.c

index ac8c1b80d7be969c71eda09d8f73350945626343..201dd62b99905a53a5864c802fefe1974a0a20de 100644 (file)
@@ -1336,7 +1336,10 @@ 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;