Skip to contentSkip to conversation

pinctrl: cirrus: cs42l43: Handle devm_pm_runtime_enable() errors

PATCH In review Haotian Zhang 2 participants 2 messages Nov 24, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: cirrus: cs42l43: Handle devm_pm_runtime_enable() errors

devm_pm_runtime_enable() can fail due to memory allocation. The current code ignores its return value, potentially causing pm_runtime_idle() to operate on uninitialized runtime PM state.

Check the return value of devm_pm_runtime_enable() and return on failure.

Fixes d5282a539297 ("pinctrl: cs42l43: Add support for the cs42l43")
---
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/cirrus/pinctrl-cs42l43.c +3 -1
index 68abb6d6cecd..fdf7e95b17ea 100644
@@ -573,7 +573,9 @@ static int cs42l43_pin_probe(struct platform_device *pdev)
 
 	device_set_node(priv->dev, fwnode);
 
-	devm_pm_runtime_enable(priv->dev);
+	ret = devm_pm_runtime_enable(priv->dev);
+	if (ret)
+		return ret;
 	pm_runtime_idle(priv->dev);
 
 	pctldev = devm_pinctrl_register(priv->dev, &cs42l43_pin_desc, priv);
Signature · 1 line
2.50.1.windows.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Haotian Zhang

devm_pm_runtime_enable() can fail due to memory allocation. The current code ignores its return value, potentially causing pm_runtime_idle() to operate on uninitialized runtime PM state.

Check the return value of devm_pm_runtime_enable() and return on failure.

Fixes d5282a539297 ("pinctrl: cs42l43: Add support for the cs42l43")

---

Thanks,
Charles