diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-03-26 11:10:18 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-03-27 17:06:34 -0400 |
commit | 38759d6175d338fbf9282c8ea2b51f3b7ab9bc98 (patch) | |
tree | a10f907656d5df8f4fb922e1a53b6e0888b47a95 | |
parent | c8d3bcbfc5eab3f01cf373d039af725f3b488813 (diff) |
RDMA/hns: ensure for-loop actually iterates and free's buffers
The current for-loop zeros variable i and only loops once, hence
not all the buffers are free'd. Fix this by setting i correctly.
Detected by CoverityScan, CID#1463415 ("Operands don't affect result")
Fixes: a5073d6054f7 ("RDMA/hns: Add eq support of hip08")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index db2ff352d75f..ec638778661c 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c | |||
@@ -4383,7 +4383,7 @@ err_dma_alloc_buf: | |||
4383 | eq->l0_dma = 0; | 4383 | eq->l0_dma = 0; |
4384 | 4384 | ||
4385 | if (mhop_num == 1) | 4385 | if (mhop_num == 1) |
4386 | for (i -= i; i >= 0; i--) | 4386 | for (i -= 1; i >= 0; i--) |
4387 | dma_free_coherent(dev, buf_chk_sz, eq->buf[i], | 4387 | dma_free_coherent(dev, buf_chk_sz, eq->buf[i], |
4388 | eq->buf_dma[i]); | 4388 | eq->buf_dma[i]); |
4389 | else if (mhop_num == 2) { | 4389 | else if (mhop_num == 2) { |