habanalabs: wrap macro arg with parentheses
authorOhad Sharabi <osharabi@habana.ai>
Mon, 18 Jul 2022 19:02:13 +0000 (22:02 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Sun, 18 Sep 2022 10:29:50 +0000 (13:29 +0300)
The macro argument <val> is cast-ed to u32 in some of the places.
Because this arg can be some arithmetic computation (e.g. address +
offset) the cast should be on the whole expression.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/habanalabs.h

index 350bc5b9f1744b5f9af3868a987c5c3549a8c410..d3efec600458e4a2e9c2d42266152e6c5fbba292 100644 (file)
@@ -2506,7 +2506,7 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val);
                                break; \
                        (val) = __elbi_read; \
                } else {\
-                       (val) = RREG32((u32)addr); \
+                       (val) = RREG32((u32)(addr)); \
                } \
                if (cond) \
                        break; \
@@ -2517,7 +2517,7 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val);
                                        break; \
                                (val) = __elbi_read; \
                        } else {\
-                               (val) = RREG32((u32)addr); \
+                               (val) = RREG32((u32)(addr)); \
                        } \
                        break; \
                } \