aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-08-19 04:52:44 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 23:48:07 -0400
commit4da79504b2b41410dd56e9268c9ad403aa65e89c (patch)
tree6a4df07feabd971a80ea17cbd3d10d66eafcf919 /drivers/net/qlge
parent0add79e3134a618c10acabe58834ac647075111a (diff)
qlge: pull NULL check ahead of dereference
There was a dereference before NULL check issue introduced in 1e213303d "qlge: Add tx multiqueue support." I've pulled the NULL check of "net_rsp" forward a couple lines to avoid that. Also Ron Mercer says that the early exit should be above the index write. ql_write_cq_idx(rx_ring); Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge')
-rw-r--r--drivers/net/qlge/qlge_main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 8d63f69b27d9..c9f9754f0784 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -2222,10 +2222,11 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
2222 ql_update_cq(rx_ring); 2222 ql_update_cq(rx_ring);
2223 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); 2223 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg);
2224 } 2224 }
2225 if (!net_rsp)
2226 return 0;
2225 ql_write_cq_idx(rx_ring); 2227 ql_write_cq_idx(rx_ring);
2226 tx_ring = &qdev->tx_ring[net_rsp->txq_idx]; 2228 tx_ring = &qdev->tx_ring[net_rsp->txq_idx];
2227 if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id) && 2229 if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id)) {
2228 net_rsp != NULL) {
2229 if (atomic_read(&tx_ring->queue_stopped) && 2230 if (atomic_read(&tx_ring->queue_stopped) &&
2230 (atomic_read(&tx_ring->tx_count) > (tx_ring->wq_len / 4))) 2231 (atomic_read(&tx_ring->tx_count) > (tx_ring->wq_len / 4)))
2231 /* 2232 /*