From: Lang Cheng <chenglang@xxxxxxxxxx> Fix complains from sparse about "dubious: x & !y" when calling hr_reg_write(ctx, field, !!val). Signed-off-by: Lang Cheng <chenglang@xxxxxxxxxx> Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx> --- drivers/infiniband/hw/hns/hns_roce_common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_common.h b/drivers/infiniband/hw/hns/hns_roce_common.h index 3a5658f..eb2d670 100644 --- a/drivers/infiniband/hw/hns/hns_roce_common.h +++ b/drivers/infiniband/hw/hns/hns_roce_common.h @@ -79,9 +79,10 @@ #define _hr_reg_write(ptr, field_type, field_h, field_l, val) \ ({ \ + u32 _val = val; \ _hr_reg_clear(ptr, field_type, field_h, field_l); \ *((__le32 *)ptr + (field_h) / 32) |= cpu_to_le32(FIELD_PREP( \ - GENMASK((field_h) % 32, (field_l) % 32), val)); \ + GENMASK((field_h) % 32, (field_l) % 32), _val)); \ }) #define hr_reg_write(ptr, field, val) _hr_reg_write(ptr, field, val) -- 2.7.4