diff options
author | Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> | 2012-02-03 09:06:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-04 15:59:31 -0500 |
commit | 81f25d96f1c9fa116f9c6f06ae490c2f8fa5ebaf (patch) | |
tree | 98a317aea5d188373e1b290fa22b045d534dcd54 /drivers/net/ethernet/qlogic/qlge | |
parent | 19257f5a1a20ceacb49a474ce39108f75ea51886 (diff) |
qlge: Fix memory leak in the process of refill
Driver was leaking memory when page allocation failures occurs.
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlge')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlge/qlge_main.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index af12e80975d1..49343ec21c82 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -1143,14 +1143,16 @@ static void ql_update_lbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) | |||
1143 | int i; | 1143 | int i; |
1144 | 1144 | ||
1145 | while (rx_ring->lbq_free_cnt > 32) { | 1145 | while (rx_ring->lbq_free_cnt > 32) { |
1146 | for (i = 0; i < 16; i++) { | 1146 | for (i = (rx_ring->lbq_clean_idx % 16); i < 16; i++) { |
1147 | netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, | 1147 | netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, |
1148 | "lbq: try cleaning clean_idx = %d.\n", | 1148 | "lbq: try cleaning clean_idx = %d.\n", |
1149 | clean_idx); | 1149 | clean_idx); |
1150 | lbq_desc = &rx_ring->lbq[clean_idx]; | 1150 | lbq_desc = &rx_ring->lbq[clean_idx]; |
1151 | if (ql_get_next_chunk(qdev, rx_ring, lbq_desc)) { | 1151 | if (ql_get_next_chunk(qdev, rx_ring, lbq_desc)) { |
1152 | rx_ring->lbq_clean_idx = clean_idx; | ||
1152 | netif_err(qdev, ifup, qdev->ndev, | 1153 | netif_err(qdev, ifup, qdev->ndev, |
1153 | "Could not get a page chunk.\n"); | 1154 | "Could not get a page chunk, i=%d, clean_idx =%d .\n", |
1155 | i, clean_idx); | ||
1154 | return; | 1156 | return; |
1155 | } | 1157 | } |
1156 | 1158 | ||
@@ -1195,7 +1197,7 @@ static void ql_update_sbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) | |||
1195 | int i; | 1197 | int i; |
1196 | 1198 | ||
1197 | while (rx_ring->sbq_free_cnt > 16) { | 1199 | while (rx_ring->sbq_free_cnt > 16) { |
1198 | for (i = 0; i < 16; i++) { | 1200 | for (i = (rx_ring->sbq_clean_idx % 16); i < 16; i++) { |
1199 | sbq_desc = &rx_ring->sbq[clean_idx]; | 1201 | sbq_desc = &rx_ring->sbq[clean_idx]; |
1200 | netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, | 1202 | netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, |
1201 | "sbq: try cleaning clean_idx = %d.\n", | 1203 | "sbq: try cleaning clean_idx = %d.\n", |