[PATCH 10/18] fec_imx: Free phy_reset GPIO if when probe fails

Andrey Smirnov andrew.smirnov at gmail.com
Tue Feb 16 17:29:11 PST 2016


Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 drivers/net/fec_imx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index c059882..d132586 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -732,7 +732,7 @@ static int fec_probe(struct device_d *dev)
 
 		ret = gpio_direction_output(phy_reset, 0);
 		if (ret)
-			goto release_res;
+			goto free_gpio;
 
 		mdelay(msec);
 		gpio_set_value(phy_reset, 1);
@@ -772,7 +772,7 @@ static int fec_probe(struct device_d *dev)
 	}
 
 	if (ret)
-		goto release_res;
+		goto free_gpio;
 
 	fec_init(edev);
 
@@ -792,6 +792,9 @@ static int fec_probe(struct device_d *dev)
 
 	return 0;
 
+free_gpio:
+	if (gpio_is_valid(phy_reset))
+		gpio_free(phy_reset);
 release_res:
 	release_region(res);
 disable_clk:
-- 
2.5.0




More information about the barebox mailing list