From: Johan Hovold <johan@kernel•org>
To: "David S. Miller" <davem@davemloft•net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st•com>,
Alexandre Torgue <alexandre.torgue@st•com>,
Joachim Eastwood <manabian@gmail•com>,
Carlo Caione <carlo@caione•org>,
Kevin Hilman <khilman@baylibre•com>,
Maxime Coquelin <mcoquelin.stm32@gmail•com>,
Maxime Ripard <maxime.ripard@free-electrons•com>,
Chen-Yu Tsai <wens@csie•org>,
netdev@vger•kernel.org, linux-kernel@vger•kernel.org,
Johan Hovold <johan@kernel•org>
Subject: [PATCH net 4/7] net: ethernet: stmmac: dwmac-generic: fix probe error path
Date: Wed, 30 Nov 2016 15:29:52 +0100 [thread overview]
Message-ID: <1480516195-27696-5-git-send-email-johan@kernel.org> (raw)
In-Reply-To: <1480516195-27696-1-git-send-email-johan@kernel.org>
Make sure to call any exit() callback to undo the effect of init()
before returning on late probe errors.
Fixes: cf3f047b9af4 ("stmmac: move hw init in the probe (v2)")
Signed-off-by: Johan Hovold <johan@kernel•org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
index b1e5f24708c9..05e46a82cdb1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -53,7 +53,17 @@ static int dwmac_generic_probe(struct platform_device *pdev)
return ret;
}
- return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+ if (ret)
+ goto err_exit;
+
+ return 0;
+
+err_exit:
+ if (plat_dat->exit)
+ plat_dat->exit(pdev, plat_dat->bsp_priv);
+
+ return ret;
}
static const struct of_device_id dwmac_generic_match[] = {
--
2.7.3
next prev parent reply other threads:[~2016-11-30 14:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 14:29 [PATCH net 0/7] net: stmmac: fix probe error handling and phydev leaks Johan Hovold
2016-11-30 14:29 ` [PATCH net 1/7] net: ethernet: stmmac: dwmac-socfpga: fix use-after-free on probe errors Johan Hovold
2016-11-30 14:29 ` [PATCH net 2/7] net: ethernet: stmmac: dwmac-sti: fix probe error path Johan Hovold
2016-11-30 14:29 ` [PATCH net 3/7] net: ethernet: stmmac: dwmac-rk: " Johan Hovold
2016-11-30 14:29 ` Johan Hovold [this message]
2016-11-30 14:29 ` [PATCH net 5/7] net: ethernet: stmmac: dwmac-meson8b: " Johan Hovold
2016-11-30 16:43 ` Kevin Hilman
2016-11-30 14:29 ` [PATCH net 6/7] net: ethernet: stmmac: platform: fix outdated function header Johan Hovold
2016-11-30 14:29 ` [PATCH net 7/7] net: ethernet: stmmac: fix of-node and fixed-link-phydev leaks Johan Hovold
2016-11-30 14:39 ` Maxime Ripard
2016-12-02 8:46 ` [PATCH net 0/7] net: stmmac: fix probe error handling and phydev leaks Giuseppe CAVALLARO
2016-12-02 15:43 ` 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=1480516195-27696-5-git-send-email-johan@kernel.org \
--to=johan@kernel$(echo .)org \
--cc=alexandre.torgue@st$(echo .)com \
--cc=carlo@caione$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=khilman@baylibre$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=manabian@gmail$(echo .)com \
--cc=maxime.ripard@free-electrons$(echo .)com \
--cc=mcoquelin.stm32@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=peppe.cavallaro@st$(echo .)com \
--cc=wens@csie$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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