diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-08 22:25:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-10 22:42:06 -0400 |
commit | a607072b8685c18fde9c34aee8402eb6190b8518 (patch) | |
tree | 2b728194657ab5f8e5e44636d6b8676b01a34c0b /drivers | |
parent | f163530407280485034c836d908b49787a8189bc (diff) |
82596: free resources on error
IRQ 56 was not freed anywhere (neither in i596_open() on error nor in
i596_close()), rx_bufs were not freed if init_i596_mem() fails,
netif_stop_queue() was not called.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/82596.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 73073d0b6894..89e43d7cb9f5 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -1015,24 +1015,35 @@ static int i596_open(struct net_device *dev) | |||
1015 | } | 1015 | } |
1016 | #ifdef ENABLE_MVME16x_NET | 1016 | #ifdef ENABLE_MVME16x_NET |
1017 | if (MACH_IS_MVME16x) { | 1017 | if (MACH_IS_MVME16x) { |
1018 | if (request_irq(0x56, i596_error, 0, "i82596_error", dev)) | 1018 | if (request_irq(0x56, i596_error, 0, "i82596_error", dev)) { |
1019 | return -EAGAIN; | 1019 | res = -EAGAIN; |
1020 | goto err_irq_dev; | ||
1021 | } | ||
1020 | } | 1022 | } |
1021 | #endif | 1023 | #endif |
1022 | res = init_rx_bufs(dev); | 1024 | res = init_rx_bufs(dev); |
1023 | if (res) { | 1025 | if (res) |
1024 | free_irq(dev->irq, dev); | 1026 | goto err_irq_56; |
1025 | return res; | ||
1026 | } | ||
1027 | 1027 | ||
1028 | netif_start_queue(dev); | 1028 | netif_start_queue(dev); |
1029 | 1029 | ||
1030 | /* Initialize the 82596 memory */ | ||
1031 | if (init_i596_mem(dev)) { | 1030 | if (init_i596_mem(dev)) { |
1032 | res = -EAGAIN; | 1031 | res = -EAGAIN; |
1033 | free_irq(dev->irq, dev); | 1032 | goto err_queue; |
1034 | } | 1033 | } |
1035 | 1034 | ||
1035 | return 0; | ||
1036 | |||
1037 | err_queue: | ||
1038 | netif_stop_queue(dev); | ||
1039 | remove_rx_bufs(dev); | ||
1040 | err_irq_56: | ||
1041 | #ifdef ENABLE_MVME16x_NET | ||
1042 | free_irq(0x56, dev); | ||
1043 | #endif | ||
1044 | err_irq_dev: | ||
1045 | free_irq(dev->irq, dev); | ||
1046 | |||
1036 | return res; | 1047 | return res; |
1037 | } | 1048 | } |
1038 | 1049 | ||
@@ -1498,6 +1509,9 @@ static int i596_close(struct net_device *dev) | |||
1498 | } | 1509 | } |
1499 | #endif | 1510 | #endif |
1500 | 1511 | ||
1512 | #ifdef ENABLE_MVME16x_NET | ||
1513 | free_irq(0x56, dev); | ||
1514 | #endif | ||
1501 | free_irq(dev->irq, dev); | 1515 | free_irq(dev->irq, dev); |
1502 | remove_rx_bufs(dev); | 1516 | remove_rx_bufs(dev); |
1503 | 1517 | ||