Commit a3623e1a authored by Haotian Zhang's avatar Haotian Zhang Committed by Miquel Raynal
Browse files

mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors



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: 6a2277a0 ("mtd: rawnand: renesas: Use runtime PM instead of the raw clock API")
Signed-off-by: default avatarHaotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 41bdec13
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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;