pinctrl: cirrus: cs42l43: Handle devm_pm_runtime_enable() errors
Subsystems (5)
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")
Signed-off-by Haotian Zhang <[email protected]>
--- drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/cirrus/pinctrl-cs42l43.c +3 -1
@@ -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
Quoted 9 lines · Haotian Zhang
devm_pm_runtime_enable()can fail due to memory allocation. The current code ignores its return value, potentially causingpm_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 <[email protected]>---
Reviewed-by Charles Keepax <[email protected]>
Thanks,
Charles