RDMA/hns: Use complete parentheses in macros
authorChengchang Tang <tangchengchang@huawei.com>
Fri, 12 Apr 2024 09:16:15 +0000 (17:16 +0800)
committerLeon Romanovsky <leon@kernel.org>
Tue, 16 Apr 2024 12:06:47 +0000 (15:06 +0300)
Use complete parentheses to ensure that macro expansion does
not produce unexpected results.

Fixes: a25d13cbe816 ("RDMA/hns: Add the interfaces to support multi hop addressing for the contexts in hip08")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240412091616.370789-10-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/hns/hns_roce_hem.h

index 6fb51db9682b8f2647172749bb3c28cfd544dbb8..9c415b2541af89e1bb85cbf6fef3d7a100a0b4b0 100644 (file)
@@ -57,16 +57,16 @@ enum {
 };
 
 #define check_whether_bt_num_3(type, hop_num) \
-       (type < HEM_TYPE_MTT && hop_num == 2)
+       ((type) < HEM_TYPE_MTT && (hop_num) == 2)
 
 #define check_whether_bt_num_2(type, hop_num) \
-       ((type < HEM_TYPE_MTT && hop_num == 1) || \
-       (type >= HEM_TYPE_MTT && hop_num == 2))
+       (((type) < HEM_TYPE_MTT && (hop_num) == 1) || \
+       ((type) >= HEM_TYPE_MTT && (hop_num) == 2))
 
 #define check_whether_bt_num_1(type, hop_num) \
-       ((type < HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0) || \
-       (type >= HEM_TYPE_MTT && hop_num == 1) || \
-       (type >= HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0))
+       (((type) < HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0) || \
+       ((type) >= HEM_TYPE_MTT && (hop_num) == 1) || \
+       ((type) >= HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0))
 
 struct hns_roce_hem {
        void *buf;