From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVqwL-0003nC-R9 for barebox@lists.infradead.org; Wed, 17 Feb 2016 01:30:02 +0000 Received: by mail-pf0-x232.google.com with SMTP id q63so1537219pfb.0 for ; Tue, 16 Feb 2016 17:29:45 -0800 (PST) From: Andrey Smirnov Date: Tue, 16 Feb 2016 17:29:08 -0800 Message-Id: <1455672559-25061-8-git-send-email-andrew.smirnov@gmail.com> In-Reply-To: <1455672559-25061-1-git-send-email-andrew.smirnov@gmail.com> References: <1455672559-25061-1-git-send-email-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 07/18] fec_imx: Deallocate clocks when probe fails To: barebox@lists.infradead.org Cc: Andrey Smirnov Signed-off-by: Andrey Smirnov --- drivers/net/fec_imx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 4465788..f413acd 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -710,7 +710,9 @@ static int fec_probe(struct device_d *dev) goto err_free; } - clk_enable(fec->clk); + ret = clk_enable(fec->clk); + if (ret < 0) + goto put_clk; fec->regs = dev_request_mem_region(dev, 0); @@ -720,11 +722,11 @@ static int fec_probe(struct device_d *dev) ret = gpio_request(phy_reset, "phy-reset"); if (ret) - goto err_free; + goto disable_clk; ret = gpio_direction_output(phy_reset, 0); if (ret) - goto err_free; + goto disable_clk; mdelay(msec); gpio_set_value(phy_reset, 1); @@ -764,7 +766,7 @@ static int fec_probe(struct device_d *dev) } if (ret) - goto err_free; + goto disable_clk; fec_init(edev); @@ -784,6 +786,10 @@ static int fec_probe(struct device_d *dev) return 0; +disable_clk: + clk_disable(fec->clk); +put_clk: + clk_put(fec->clk); err_free: free(fec); return ret; -- 2.5.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox