]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
habanalabs: correctly cast variable to __le32
authorOded Gabbay <oded.gabbay@gmail.com>
Tue, 3 Sep 2019 08:33:55 +0000 (11:33 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 5 Sep 2019 11:55:28 +0000 (14:55 +0300)
When using the macro le32_to_cpu(x), we need to correctly convert x to be
__le32 in case it is defined as u32 variable.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Tomer Tayar <ttayar@habana.ai>
drivers/misc/habanalabs/habanalabs.h

index c39e07d665c4475efa7fff1ee47549da97adf625..75862be53c60e7d458017536e7eb80fca0797587 100644 (file)
@@ -1107,13 +1107,13 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val);
                mb(); \
                (val) = *((u32 *) (uintptr_t) (addr)); \
                if (mem_written_by_device) \
-                       (val) = le32_to_cpu(val); \
+                       (val) = le32_to_cpu(*(__le32 *) &(val)); \
                if (cond) \
                        break; \
                if (timeout_us && ktime_compare(ktime_get(), __timeout) > 0) { \
                        (val) = *((u32 *) (uintptr_t) (addr)); \
                        if (mem_written_by_device) \
-                               (val) = le32_to_cpu(val); \
+                               (val) = le32_to_cpu(*(__le32 *) &(val)); \
                        break; \
                } \
                if (sleep_us) \