netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ixp4xx_eth: Fix an error handling path in ixp4xx_eth_probe()
@ 2022-12-21  7:17 Christophe JAILLET
  2022-12-21 18:50 ` Michal Swiatkowski
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2022-12-21  7:17 UTC (permalink / raw)
  To: Krzysztof Halasa, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Krzysztof Hałasa
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

If an error occurs after a successful ixp4xx_mdio_register() call, it
should be undone by a corresponding ixp4xx_mdio_remove().

Add the missing call in the error handling path, as already done in the
remove function.

Fixes: 2098c18d6cf6 ("IXP4xx: Add PHYLIB support to Ethernet driver.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 3b0c5f177447..007d68b385a5 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1490,8 +1490,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 
 	netif_napi_add_weight(ndev, &port->napi, eth_poll, NAPI_WEIGHT);
 
-	if (!(port->npe = npe_request(NPE_ID(port->id))))
-		return -EIO;
+	if (!(port->npe = npe_request(NPE_ID(port->id)))) {
+		err = -EIO;
+		goto err_remove_mdio;
+	}
 
 	port->plat = plat;
 	npe_port_tab[NPE_ID(port->id)] = port;
@@ -1530,6 +1532,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 err_free_mem:
 	npe_port_tab[NPE_ID(port->id)] = NULL;
 	npe_release(port->npe);
+err_remove_mdio:
+	ixp4xx_mdio_remove();
 	return err;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-22  1:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-21  7:17 [PATCH] ixp4xx_eth: Fix an error handling path in ixp4xx_eth_probe() Christophe JAILLET
2022-12-21 18:50 ` Michal Swiatkowski
2022-12-22  1:38   ` Jakub Kicinski

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).