Skip to contentSkip to conversation

memory: stm32-omm: fail probe if runtime PM setup fails

PATCH In review Jiawen Liu 2 participants 2 messages Nov 29 – Nov 30

Subsystems (3)
lore
Share & tools
lore

Jiawen Liu

author
#0 lore raw

PATCH 1/1 memory: stm32-omm: fail probe if runtime PM setup fails

stm32_omm_probe() ignored a failure from devm_pm_runtime_enable(). The helper rolls runtime PM back when action registration fails, but probe could continue and later require runtime resume while runtime PM was disabled.

Propagate the setup error before configuring the OMM or populating its children.

Fixes 8181d061dcff ("memory: Add STM32 Octo Memory Manager driver")
---
 drivers/memory/stm32_omm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/memory/stm32_omm.c +3 -1
index e5d646e0a13cf..2d0c8fe7625be 100644
@@ -337,7 +337,9 @@ static int stm32_omm_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, omm);
 
-	devm_pm_runtime_enable(dev);
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
 
 	/* check if OMM's resource access is granted */
 	ret = stm32_omm_check_access(dev->of_node);
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Jiawen Liu

stm32_omm_probe() ignored a failure from devm_pm_runtime_enable(). The helper rolls runtime PM back when action registration fails, but probe could continue and later require runtime resume while runtime PM was disabled.

Propagate the setup error before configuring the OMM or populating its children.

Fixes 8181d061dcff ("memory: Add STM32 Octo Memory Manager driver")
---
 drivers/memory/stm32_omm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/memory/stm32_omm.c +0 -0
index e5d646e0a13cf..2d0c8fe7625be 100644

drivers/memory/stm32_omm.c static int stm32_omm_probe(struct platform_device *pdev) · line 345

Quoted 10 lines
drivers/memory/stm32_omm.c +3 -1
@@ -337,7 +337,9 @@ static int stm32_omm_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, omm);
 
-	devm_pm_runtime_enable(dev);
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
 
 	/* check if OMM's resource access is granted */
 	ret = stm32_omm_check_access(dev->of_node);

Hi Jiawen

Thanks
Patrice