[07/10] net: ax88796: unregister mdiobus on ax_mii_init() fail

Message ID 1523916285-6057-8-git-send-email-schmitzmic@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series
  • New network driver for Amiga X-Surf 100 (m68k)
Related show

Commit Message

Michael Schmitz April 16, 2018, 10:04 p.m.
From: Michael Schmitz <schmitz@debian.org>

Unregister and free up mdiobus resources if ax_mii_init() failed.

Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
---
 drivers/net/ethernet/8390/ax88796.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index b09cdc6..6af9aca 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -415,7 +415,7 @@  static int ax_open(struct net_device *dev)
 
 	ret = ax_mii_init(dev);
 	if (ret)
-		goto failed_request_irq;
+		goto failed_mii;
 
 	if (ax->plat->check_irq)
 		ret = request_irq(dev->irq, ax_ei_interrupt_filtered,
@@ -448,6 +448,10 @@  static int ax_open(struct net_device *dev)
 	ax_phy_switch(dev, 0);
 	free_irq(dev->irq, dev);
  failed_request_irq:
+	/* unregister mdiobus */
+	mdiobus_unregister(ax->mii_bus);
+	free_mdio_bitbang(ax->mii_bus);
+ failed_mii:
 	return ret;
 }