summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-07-22 10:09:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-12-16 09:24:04 +0100
commit399eef3f85593b82ec15af15524108acc6720b41 (patch)
tree2cb30b197065302e921c9c3fe1d0d5fda3821633 /drivers
parent4be02c0879d4580b9018ebd6336d41838ba6aa5a (diff)
downloadbarebox-399eef3f85593b82ec15af15524108acc6720b41.tar.gz
barebox-399eef3f85593b82ec15af15524108acc6720b41.tar.xz
phy: stm32-usphyc: release resources to properly support EPROBE_DEFER
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/phy/phy-stm32-usbphyc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index 093842fe14..d9eaa8a754 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;
}