]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/hns: Use complete parentheses in macros
authorChengchang Tang <tangchengchang@huawei.com>
Fri, 12 Apr 2024 09:16:15 +0000 (17:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:32:13 +0000 (13:32 +0200)
[ Upstream commit 4125269bb9b22e1d8cdf4412c81be8074dbc61ca ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_hem.h

index b7617786b100564cd855a97612c98e5c73b8640b..5b2162a2b8cef4bdf184790fe550208536fab67b 100644 (file)
@@ -60,16 +60,16 @@ enum {
         (sizeof(struct scatterlist) + sizeof(void *)))
 
 #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_chunk {
        struct list_head         list;