From: Bruce Lane The error path in octeon_mgmt_open() misses the cleanup operations for octeon_mgmt_init_phy() if request_irq() fails. Add an error label and the corresponding cleanup functions. Fixes: eeae05aa2169 ("netdev: octeon_mgmt: Add support for 1Gig ports.") Signed-off-by: Bruce Lane --- drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c index bb72c0833721..514ee9a180f2 100644 --- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c @@ -1073,7 +1073,7 @@ static int octeon_mgmt_open(struct net_device *netdev) /* Read the PHY to find the mode of the interface. */ if (octeon_mgmt_init_phy(netdev)) { dev_err(p->dev, "Cannot initialize PHY on MIX%d.\n", p->port); - goto err_noirq; + goto err_nophy; } /* Set the mode of the interface, RGMII/MII. */ @@ -1223,7 +1223,12 @@ static int octeon_mgmt_open(struct net_device *netdev) napi_enable(&p->napi); return 0; + err_noirq: + if (netdev->phydev) + phy_disconnect(netdev->phydev); + netif_carrier_off(netdev); +err_nophy: octeon_mgmt_reset_hw(p); dma_unmap_single(p->dev, p->rx_ring_handle, ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), -- 2.25.1