[PATCH] pinctrl: cirrus: cs42l43: Handle devm_pm_runtime_enable() errors

Haotian Zhang posted 1 patch 1 week ago
drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] pinctrl: cirrus: cs42l43: Handle devm_pm_runtime_enable() errors
Posted by Haotian Zhang 1 week ago
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")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index 68abb6d6cecd..fdf7e95b17ea 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -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);
-- 
2.50.1.windows.1
Re: [PATCH] pinctrl: cirrus: cs42l43: Handle devm_pm_runtime_enable() errors
Posted by Charles Keepax 1 week ago
On Mon, Nov 24, 2025 at 09:49:33AM +0800, Haotian Zhang wrote:
> 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")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles