diff options
author | Jan Sokolowski <jan.sokolowski@intel.com> | 2017-11-06 06:38:45 -0800 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-11-13 15:53:57 -0500 |
commit | e4c397eed9c93fc1cb34f7d8df96afeb320d535d (patch) | |
tree | c5db7fa9606ebb771c59c476d6c5b0723993a8a8 /drivers/infiniband/hw/hfi1/user_sdma.c | |
parent | d61ea0751aa097182291c7ceed447bc73e020109 (diff) | |
download | linux-stable-e4c397eed9c93fc1cb34f7d8df96afeb320d535d.tar.gz linux-stable-e4c397eed9c93fc1cb34f7d8df96afeb320d535d.tar.bz2 linux-stable-e4c397eed9c93fc1cb34f7d8df96afeb320d535d.zip |
IB/hfi1: Remove unnecessary if check
A for loop condition of data_iovs in user_sdma_free_request
is unnecessarily repeated before the loop as an if check.
Remove the if enveloping the loop.
Reviewed-by: Jakub Byczkowski <jakub.byczkowski@intel.com>
Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/user_sdma.c')
-rw-r--r-- | drivers/infiniband/hw/hfi1/user_sdma.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c index 01b9a9c6c2af..833d0b7277bc 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.c +++ b/drivers/infiniband/hw/hfi1/user_sdma.c @@ -1428,6 +1428,8 @@ static inline void pq_update(struct hfi1_user_sdma_pkt_q *pq) static void user_sdma_free_request(struct user_sdma_request *req, bool unpin) { + int i; + if (!list_empty(&req->txps)) { struct sdma_txreq *t, *p; @@ -1439,22 +1441,20 @@ static void user_sdma_free_request(struct user_sdma_request *req, bool unpin) kmem_cache_free(req->pq->txreq_cache, tx); } } - if (req->data_iovs) { - struct sdma_mmu_node *node; - int i; - - for (i = 0; i < req->data_iovs; i++) { - node = req->iovs[i].node; - if (!node) - continue; - - if (unpin) - hfi1_mmu_rb_remove(req->pq->handler, - &node->rb); - else - atomic_dec(&node->refcount); - } + + for (i = 0; i < req->data_iovs; i++) { + struct sdma_mmu_node *node = req->iovs[i].node; + + if (!node) + continue; + + if (unpin) + hfi1_mmu_rb_remove(req->pq->handler, + &node->rb); + else + atomic_dec(&node->refcount); } + kfree(req->tids); clear_bit(req->info.comp_idx, req->pq->req_in_use); } |