Commit a2fc66ce authored by Veaceslav Falico's avatar Veaceslav Falico Committed by David S. Miller

pch_gbe: fix error handling in pch_gbe_up()

If we fail to allocate rx buffers pool by any reason, we'll just return
with an error, however we've previously successfully requested an irq. Fix
this by releasing the irq before returning the error.
Signed-off-by: default avatarVeaceslav Falico <vfalico@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 37561f68
...@@ -1930,12 +1930,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) ...@@ -1930,12 +1930,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter)
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring;
int err; int err = -EINVAL;
/* Ensure we have a valid MAC */ /* Ensure we have a valid MAC */
if (!is_valid_ether_addr(adapter->hw.mac.addr)) { if (!is_valid_ether_addr(adapter->hw.mac.addr)) {
pr_err("Error: Invalid MAC address\n"); pr_err("Error: Invalid MAC address\n");
return -EINVAL; goto out;
} }
/* hardware has been reset, we need to reload some things */ /* hardware has been reset, we need to reload some things */
...@@ -1948,13 +1948,13 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) ...@@ -1948,13 +1948,13 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter)
err = pch_gbe_request_irq(adapter); err = pch_gbe_request_irq(adapter);
if (err) { if (err) {
pr_err("Error: can't bring device up\n"); pr_err("Error: can't bring device up - irq request failed\n");
return err; goto out;
} }
err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count);
if (err) { if (err) {
pr_err("Error: can't bring device up\n"); pr_err("Error: can't bring device up - alloc rx buffers pool failed\n");
return err; goto freeirq;
} }
pch_gbe_alloc_tx_buffers(adapter, tx_ring); pch_gbe_alloc_tx_buffers(adapter, tx_ring);
pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count);
...@@ -1969,6 +1969,11 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) ...@@ -1969,6 +1969,11 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter)
netif_start_queue(adapter->netdev); netif_start_queue(adapter->netdev);
return 0; return 0;
freeirq:
pch_gbe_free_irq(adapter);
out:
return err;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment