diff mbox series

[for-next] RDMA/hns: Fix restricted __le16 degrades to integer issue

Message ID 20240909065331.3950268-1-huangjunxian6@hisilicon.com (mailing list archive)
State Accepted
Headers show
Series [for-next] RDMA/hns: Fix restricted __le16 degrades to integer issue | expand

Commit Message

Junxian Huang Sept. 9, 2024, 6:53 a.m. UTC
Fix sparse warnings: restricted __le16 degrades to integer.

Fixes: 5a87279591a1 ("RDMA/hns: Support hns HW stats")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409080508.g4mNSLwy-lkp@intel.com/
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky Sept. 10, 2024, 1:43 p.m. UTC | #1
On Mon, 09 Sep 2024 14:53:31 +0800, Junxian Huang wrote:
> Fix sparse warnings: restricted __le16 degrades to integer.
> 
> 

Applied, thanks!

[1/1] RDMA/hns: Fix restricted __le16 degrades to integer issue
      https://git.kernel.org/rdma/rdma/c/f4ccc0a2a0c597

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 621b057fb9da..78a18608f4c5 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1681,8 +1681,8 @@  static int hns_roce_hw_v2_query_counter(struct hns_roce_dev *hr_dev,
 
 	for (i = 0; i < HNS_ROCE_HW_CNT_TOTAL && i < *num_counters; i++) {
 		bd_idx = i / CNT_PER_DESC;
-		if (!(desc[bd_idx].flag & HNS_ROCE_CMD_FLAG_NEXT) &&
-		    bd_idx != HNS_ROCE_HW_CNT_TOTAL / CNT_PER_DESC)
+		if (bd_idx != HNS_ROCE_HW_CNT_TOTAL / CNT_PER_DESC &&
+		    !(desc[bd_idx].flag & cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT)))
 			break;
 
 		cnt_data = (__le64 *)&desc[bd_idx].data[0];