Commit 719af321 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

spi: cs42l43: Use devm_add_action_or_reset()

Use devm_add_action_or_reset() rather than manually cleaning up on the
error path.
Suggested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240417093026.79396-1-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1f48cbd6
...@@ -345,12 +345,10 @@ static int cs42l43_spi_probe(struct platform_device *pdev) ...@@ -345,12 +345,10 @@ static int cs42l43_spi_probe(struct platform_device *pdev)
if (is_of_node(fwnode)) { if (is_of_node(fwnode)) {
fwnode = fwnode_get_named_child_node(fwnode, "spi"); fwnode = fwnode_get_named_child_node(fwnode, "spi");
ret = devm_add_action(priv->dev, cs42l43_release_of_node, fwnode); ret = devm_add_action_or_reset(priv->dev, cs42l43_release_of_node, fwnode);
if (ret) { if (ret)
fwnode_handle_put(fwnode);
return ret; return ret;
} }
}
if (has_sidecar) { if (has_sidecar) {
ret = software_node_register(&cs42l43_gpiochip_swnode); ret = software_node_register(&cs42l43_gpiochip_swnode);
...@@ -358,11 +356,9 @@ static int cs42l43_spi_probe(struct platform_device *pdev) ...@@ -358,11 +356,9 @@ static int cs42l43_spi_probe(struct platform_device *pdev)
return dev_err_probe(priv->dev, ret, return dev_err_probe(priv->dev, ret,
"Failed to register gpio swnode\n"); "Failed to register gpio swnode\n");
ret = devm_add_action(priv->dev, cs42l43_release_sw_node, NULL); ret = devm_add_action_or_reset(priv->dev, cs42l43_release_sw_node, NULL);
if (ret) { if (ret)
software_node_unregister(&cs42l43_gpiochip_swnode);
return ret; return ret;
}
ret = device_create_managed_software_node(&priv->ctlr->dev, ret = device_create_managed_software_node(&priv->ctlr->dev,
cs42l43_cs_props, NULL); cs42l43_cs_props, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment