All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: <andy.shevchenko@gmail.com>, <linux-spi@vger.kernel.org>,
	<patches@opensource.cirrus.com>
Subject: [PATCH] spi: cs42l43: Use devm_add_action_or_reset()
Date: Wed, 17 Apr 2024 10:30:26 +0100	[thread overview]
Message-ID: <20240417093026.79396-1-ckeepax@opensource.cirrus.com> (raw)

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>
---
 drivers/spi/spi-cs42l43.c | 12 ++++--------
 1 file 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);
-- 
2.39.2


             reply	other threads:[~2024-04-17  9:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17  9:30 Charles Keepax [this message]
2024-04-17 11:05 ` [PATCH] spi: cs42l43: Use devm_add_action_or_reset() Andy Shevchenko
2024-04-18  0:51 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240417093026.79396-1-ckeepax@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.