mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/2] regulator: stm32-pwr: release resources to properly support EPROBE_DEFER
Date: Wed, 22 Jul 2020 10:09:56 +0200	[thread overview]
Message-ID: <20200722080956.17454-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200722080956.17454-1-a.fatoum@pengutronix.de>

Driver failed to release resources on failed probe so far, leading to
deferred probe failing with -EBUSY. Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/regulator/stm32-pwr.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/stm32-pwr.c b/drivers/regulator/stm32-pwr.c
index 296f95bc4c32..99cabc5f8882 100644
--- a/drivers/regulator/stm32-pwr.c
+++ b/drivers/regulator/stm32-pwr.c
@@ -184,18 +184,25 @@ static int stm32_pwr_regulator_probe(struct device_d *dev)
 		priv->rdev.desc = &desc->desc;
 
 		priv->supply = regulator_get(dev, desc->supply_name);
-		if (IS_ERR(priv->supply))
-			return PTR_ERR(priv->supply);
+		if (IS_ERR(priv->supply)) {
+			ret = PTR_ERR(priv->supply);
+			goto release_region;
+		}
 
 		ret = of_regulator_register(&priv->rdev, child);
 		if (ret) {
 			dev_err(dev, "%s: Failed to register regulator: %d\n",
 				desc->name, ret);
-			return ret;
+			goto release_region;
 		}
 	}
 
 	return 0;
+
+release_region:
+	release_region(iores);
+
+	return ret;
 }
 
 static const struct of_device_id stm32_pwr_of_match[] = {
-- 
2.27.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-07-22  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  8:09 [PATCH 1/2] phy: stm32-usphyc: " Ahmad Fatoum
2020-07-22  8:09 ` Ahmad Fatoum [this message]
2020-12-14 17:53 ` Ahmad Fatoum
2020-12-16  8:28   ` Sascha Hauer

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=20200722080956.17454-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox