Commit 4da79504 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

qlge: pull NULL check ahead of dereference

There was a dereference before NULL check issue introduced in 1e213303
"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: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarRon Mercer <ron.mercer@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0add79e3
...@@ -2222,10 +2222,11 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring) ...@@ -2222,10 +2222,11 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
ql_update_cq(rx_ring); ql_update_cq(rx_ring);
prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg);
} }
if (!net_rsp)
return 0;
ql_write_cq_idx(rx_ring); ql_write_cq_idx(rx_ring);
tx_ring = &qdev->tx_ring[net_rsp->txq_idx]; tx_ring = &qdev->tx_ring[net_rsp->txq_idx];
if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id) && if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id)) {
net_rsp != NULL) {
if (atomic_read(&tx_ring->queue_stopped) && if (atomic_read(&tx_ring->queue_stopped) &&
(atomic_read(&tx_ring->tx_count) > (tx_ring->wq_len / 4))) (atomic_read(&tx_ring->tx_count) > (tx_ring->wq_len / 4)))
/* /*
......
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