diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2012-10-23 00:54:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-24 23:04:31 -0400 |
commit | a2fc66ce9f4669daeebc03d6891917b894c752a8 (patch) | |
tree | 3f362f7dff5c7af02776c1b829520c4e84e43d9a /drivers/net | |
parent | 37561f68bd527ec39076e32effdc7b1dcdfb17ea (diff) |
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: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index a8854d04c275..4c4fe5b1a29a 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -1930,12 +1930,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
1930 | struct net_device *netdev = adapter->netdev; | 1930 | struct net_device *netdev = adapter->netdev; |
1931 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; | 1931 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; |
1932 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; | 1932 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; |
1933 | int err; | 1933 | int err = -EINVAL; |
1934 | 1934 | ||
1935 | /* Ensure we have a valid MAC */ | 1935 | /* Ensure we have a valid MAC */ |
1936 | if (!is_valid_ether_addr(adapter->hw.mac.addr)) { | 1936 | if (!is_valid_ether_addr(adapter->hw.mac.addr)) { |
1937 | pr_err("Error: Invalid MAC address\n"); | 1937 | pr_err("Error: Invalid MAC address\n"); |
1938 | return -EINVAL; | 1938 | goto out; |
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | /* hardware has been reset, we need to reload some things */ | 1941 | /* hardware has been reset, we need to reload some things */ |
@@ -1948,13 +1948,13 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
1948 | 1948 | ||
1949 | err = pch_gbe_request_irq(adapter); | 1949 | err = pch_gbe_request_irq(adapter); |
1950 | if (err) { | 1950 | if (err) { |
1951 | pr_err("Error: can't bring device up\n"); | 1951 | pr_err("Error: can't bring device up - irq request failed\n"); |
1952 | return err; | 1952 | goto out; |
1953 | } | 1953 | } |
1954 | err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); | 1954 | err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); |
1955 | if (err) { | 1955 | if (err) { |
1956 | pr_err("Error: can't bring device up\n"); | 1956 | pr_err("Error: can't bring device up - alloc rx buffers pool failed\n"); |
1957 | return err; | 1957 | goto freeirq; |
1958 | } | 1958 | } |
1959 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); | 1959 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); |
1960 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); | 1960 | 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 | netif_start_queue(adapter->netdev); | 1969 | netif_start_queue(adapter->netdev); |
1970 | 1970 | ||
1971 | return 0; | 1971 | return 0; |
1972 | |||
1973 | freeirq: | ||
1974 | pch_gbe_free_irq(adapter); | ||
1975 | out: | ||
1976 | return err; | ||
1972 | } | 1977 | } |
1973 | 1978 | ||
1974 | /** | 1979 | /** |