diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2024-04-17 12:30:26 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-04-17 17:01:10 +0300 |
commit | 719af321a84b9b6669a82a94708e7ca574971331 (patch) | |
tree | 29f0756d7f8c2978ba3b01d185dedf9604c43d00 /drivers | |
parent | 1f48cbd6f00f2d1442ac8757ae8c32b672073927 (diff) | |
download | linux-719af321a84b9b6669a82a94708e7ca574971331.tar.xz |
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: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240417093026.79396-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-cs42l43.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/spi/spi-cs42l43.c b/drivers/spi/spi-cs42l43.c index cffd9a177808..cdc61cd089ad 100644 --- a/drivers/spi/spi-cs42l43.c +++ b/drivers/spi/spi-cs42l43.c @@ -345,11 +345,9 @@ static int cs42l43_spi_probe(struct platform_device *pdev) if (is_of_node(fwnode)) { fwnode = fwnode_get_named_child_node(fwnode, "spi"); - ret = devm_add_action(priv->dev, cs42l43_release_of_node, fwnode); - if (ret) { - fwnode_handle_put(fwnode); + ret = devm_add_action_or_reset(priv->dev, cs42l43_release_of_node, fwnode); + if (ret) return ret; - } } if (has_sidecar) { @@ -358,11 +356,9 @@ static int cs42l43_spi_probe(struct platform_device *pdev) return dev_err_probe(priv->dev, ret, "Failed to register gpio swnode\n"); - ret = devm_add_action(priv->dev, cs42l43_release_sw_node, NULL); - if (ret) { - software_node_unregister(&cs42l43_gpiochip_swnode); + ret = devm_add_action_or_reset(priv->dev, cs42l43_release_sw_node, NULL); + if (ret) return ret; - } ret = device_create_managed_software_node(&priv->ctlr->dev, cs42l43_cs_props, NULL); |