Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38759d61 authored by Colin Ian King's avatar Colin Ian King Committed by Jason Gunthorpe
Browse files

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: a5073d60 ("RDMA/hns: Add eq support of hip08")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarYixian Liu <liuyixian@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent c8d3bcbf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4383,7 +4383,7 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev,
	eq->l0_dma = 0;

	if (mhop_num == 1)
		for (i -= i; i >= 0; i--)
		for (i -= 1; i >= 0; i--)
			dma_free_coherent(dev, buf_chk_sz, eq->buf[i],
					  eq->buf_dma[i]);
	else if (mhop_num == 2) {