Skip to content

Commit 4125269

Browse files
Chengchang Tangrleon
authored andcommitted
RDMA/hns: Use complete parentheses in macros
Use complete parentheses to ensure that macro expansion does not produce unexpected results. Fixes: a25d13c ("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>
1 parent 9a84848 commit 4125269

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/infiniband/hw/hns/hns_roce_hem.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ enum {
5757
};
5858

5959
#define check_whether_bt_num_3(type, hop_num) \
60-
(type < HEM_TYPE_MTT && hop_num == 2)
60+
((type) < HEM_TYPE_MTT && (hop_num) == 2)
6161

6262
#define check_whether_bt_num_2(type, hop_num) \
63-
((type < HEM_TYPE_MTT && hop_num == 1) || \
64-
(type >= HEM_TYPE_MTT && hop_num == 2))
63+
(((type) < HEM_TYPE_MTT && (hop_num) == 1) || \
64+
((type) >= HEM_TYPE_MTT && (hop_num) == 2))
6565

6666
#define check_whether_bt_num_1(type, hop_num) \
67-
((type < HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0) || \
68-
(type >= HEM_TYPE_MTT && hop_num == 1) || \
69-
(type >= HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0))
67+
(((type) < HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0) || \
68+
((type) >= HEM_TYPE_MTT && (hop_num) == 1) || \
69+
((type) >= HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0))
7070

7171
struct hns_roce_hem {
7272
void *buf;

0 commit comments

Comments
 (0)