From: Fabio Estevam <festevam@gmail.com>
To: davem@davemloft.net
Cc: rmk+kernel@arm.linux.org.uk, Frank.Li@freescale.com,
netdev@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH net-next] fec: Fix fec_enet_alloc_buffers() error path
Date: Sat, 4 Oct 2014 13:40:01 -0300 [thread overview]
Message-ID: <1412440801-15381-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@freescale.com>
When fec_enet_alloc_buffers() fails we should better undo the previous actions,
which consists of: disabling the FEC clocks and putting the FEC pins into
inactive state.
The error path for fec_enet_mii_probe() is kept unchanged.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/net/ethernet/freescale/fec_main.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 1f07db8..620feaf 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2746,16 +2746,12 @@ fec_enet_open(struct net_device *ndev)
ret = fec_enet_alloc_buffers(ndev);
if (ret)
- return ret;
+ goto err_enet_alloc;
/* Probe and connect to PHY when open the interface */
ret = fec_enet_mii_probe(ndev);
- if (ret) {
- fec_enet_free_buffers(ndev);
- fec_enet_clk_enable(ndev, false);
- pinctrl_pm_select_sleep_state(&fep->pdev->dev);
- return ret;
- }
+ if (ret)
+ goto err_enet_mii_probe;
fec_restart(ndev);
napi_enable(&fep->napi);
@@ -2763,6 +2759,13 @@ fec_enet_open(struct net_device *ndev)
netif_tx_start_all_queues(ndev);
return 0;
+
+err_enet_mii_probe:
+ fec_enet_free_buffers(ndev);
+err_enet_alloc:
+ fec_enet_clk_enable(ndev, false);
+ pinctrl_pm_select_sleep_state(&fep->pdev->dev);
+ return ret;
}
static int
--
1.9.1
next reply other threads:[~2014-10-04 16:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-04 16:40 Fabio Estevam [this message]
2014-10-06 4:54 ` [PATCH net-next] fec: Fix fec_enet_alloc_buffers() error path David Miller
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=1412440801-15381-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=Frank.Li@freescale.com \
--cc=davem@davemloft.net \
--cc=fabio.estevam@freescale.com \
--cc=netdev@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).