mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] phy: stm32-usphyc: release resources to properly support EPROBE_DEFER
@ 2020-07-22  8:09 Ahmad Fatoum
  2020-07-22  8:09 ` [PATCH 2/2] regulator: stm32-pwr: " Ahmad Fatoum
  2020-12-14 17:53 ` [PATCH 1/2] phy: stm32-usphyc: " Ahmad Fatoum
  0 siblings, 2 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-07-22  8:09 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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/phy/phy-stm32-usbphyc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index 093842fe1460..d9eaa8a7544a 100644
--- a/drivers/phy/phy-stm32-usbphyc.c
+++ b/drivers/phy/phy-stm32-usbphyc.c
@@ -328,13 +328,13 @@ static int stm32_usbphyc_probe(struct device_d *dev)
 	if (IS_ERR(usbphyc->clk)) {
 		ret = PTR_ERR(usbphyc->clk);
 		dev_err(dev, "clk get failed: %d\n", ret);
-		return ret;
+		goto release_region;
 	}
 
 	ret = clk_enable(usbphyc->clk);
 	if (ret) {
 		dev_err(dev, "clk enable failed: %d\n", ret);
-		return ret;
+		goto release_region;
 	}
 
 	device_reset_us(dev, 2);
@@ -405,6 +405,11 @@ static int stm32_usbphyc_probe(struct device_d *dev)
 
 clk_disable:
 	clk_disable(usbphyc->clk);
+release_region:
+	release_region(iores);
+
+	free(usbphyc->phys);
+	free(usbphyc);
 
 	return ret;
 }
-- 
2.27.0


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] regulator: stm32-pwr: release resources to properly support EPROBE_DEFER
  2020-07-22  8:09 [PATCH 1/2] phy: stm32-usphyc: release resources to properly support EPROBE_DEFER Ahmad Fatoum
@ 2020-07-22  8:09 ` Ahmad Fatoum
  2020-12-14 17:53 ` [PATCH 1/2] phy: stm32-usphyc: " Ahmad Fatoum
  1 sibling, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-07-22  8:09 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] phy: stm32-usphyc: release resources to properly support EPROBE_DEFER
  2020-07-22  8:09 [PATCH 1/2] phy: stm32-usphyc: release resources to properly support EPROBE_DEFER Ahmad Fatoum
  2020-07-22  8:09 ` [PATCH 2/2] regulator: stm32-pwr: " Ahmad Fatoum
@ 2020-12-14 17:53 ` Ahmad Fatoum
  2020-12-16  8:28   ` Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2020-12-14 17:53 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Michael Grzeschik

Hello Sascha,

On 22.07.20 10:09, Ahmad Fatoum wrote:
> 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>

As we still have EPROBE_DEFER, it would be nice if this could
be merged.

Cheers,
Ahmad

> ---
>  drivers/phy/phy-stm32-usbphyc.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
> index 093842fe1460..d9eaa8a7544a 100644
> --- a/drivers/phy/phy-stm32-usbphyc.c
> +++ b/drivers/phy/phy-stm32-usbphyc.c
> @@ -328,13 +328,13 @@ static int stm32_usbphyc_probe(struct device_d *dev)
>  	if (IS_ERR(usbphyc->clk)) {
>  		ret = PTR_ERR(usbphyc->clk);
>  		dev_err(dev, "clk get failed: %d\n", ret);
> -		return ret;
> +		goto release_region;
>  	}
>  
>  	ret = clk_enable(usbphyc->clk);
>  	if (ret) {
>  		dev_err(dev, "clk enable failed: %d\n", ret);
> -		return ret;
> +		goto release_region;
>  	}
>  
>  	device_reset_us(dev, 2);
> @@ -405,6 +405,11 @@ static int stm32_usbphyc_probe(struct device_d *dev)
>  
>  clk_disable:
>  	clk_disable(usbphyc->clk);
> +release_region:
> +	release_region(iores);
> +
> +	free(usbphyc->phys);
> +	free(usbphyc);
>  
>  	return ret;
>  }
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] phy: stm32-usphyc: release resources to properly support EPROBE_DEFER
  2020-12-14 17:53 ` [PATCH 1/2] phy: stm32-usphyc: " Ahmad Fatoum
@ 2020-12-16  8:28   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2020-12-16  8:28 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Michael Grzeschik

On Mon, Dec 14, 2020 at 06:53:08PM +0100, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 22.07.20 10:09, Ahmad Fatoum wrote:
> > 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>
> 
> As we still have EPROBE_DEFER, it would be nice if this could
> be merged.

Just did that.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-16  8:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  8:09 [PATCH 1/2] phy: stm32-usphyc: release resources to properly support EPROBE_DEFER Ahmad Fatoum
2020-07-22  8:09 ` [PATCH 2/2] regulator: stm32-pwr: " Ahmad Fatoum
2020-12-14 17:53 ` [PATCH 1/2] phy: stm32-usphyc: " Ahmad Fatoum
2020-12-16  8:28   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox