[PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Haoyue Xu <xuhaoyue1@xxxxxxxxxxxxx>

The "ret" should be initialized when it is defined instead of in the loop.

Signed-off-by: Haoyue Xu <xuhaoyue1@xxxxxxxxxxxxx>
Signed-off-by: Wenpeng Liang <liangwenpeng@xxxxxxxxxx>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index ae4f6fa8ad71..556d79fb2352 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1260,8 +1260,8 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
 	struct hns_roce_v2_cmq_ring *csq = &priv->cmq.csq;
 	u32 timeout = 0;
 	u16 desc_ret;
+	int ret = 0;
 	u32 tail;
-	int ret;
 	int i;
 
 	spin_lock_bh(&csq->lock);
@@ -1284,7 +1284,7 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
 	} while (++timeout < priv->cmq.tx_timeout);
 
 	if (hns_roce_cmq_csq_done(hr_dev)) {
-		for (ret = 0, i = 0; i < num; i++) {
+		for (i = 0; i < num; i++) {
 			/* check the result of hardware write back */
 			desc[i] = csq->desc[tail++];
 			if (tail == csq->desc_num)
-- 
2.33.0




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux