powerpc/fadump: Annotate endianness cast with __force
authorBenjamin Gray <bgray@linux.ibm.com>
Wed, 11 Oct 2023 05:37:11 +0000 (16:37 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 19 Oct 2023 06:16:20 +0000 (17:16 +1100)
Sparse reports an endianness error with the else case of

  val = (cpu_endian ? be64_to_cpu(reg_entry->reg_val) :
         (u64)(reg_entry->reg_val));

This is a safe operation because the code is explicitly working with
dynamic endianness, so add the __force annotation to tell Sparse to
ignore it.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231011053711.93427-13-bgray@linux.ibm.com
arch/powerpc/platforms/powernv/opal-fadump.h

index 3f715efb0aa6ee4e3ee9ddc9e02eef7db5b2150d..5eeb794b5eb1ec26285eaf651a4c42b95af6292b 100644 (file)
@@ -135,7 +135,7 @@ static inline void opal_fadump_read_regs(char *bufp, unsigned int regs_cnt,
        for (i = 0; i < regs_cnt; i++, bufp += reg_entry_size) {
                reg_entry = (struct hdat_fadump_reg_entry *)bufp;
                val = (cpu_endian ? be64_to_cpu(reg_entry->reg_val) :
-                      (u64)(reg_entry->reg_val));
+                      (u64 __force)(reg_entry->reg_val));
                opal_fadump_set_regval_regnum(regs,
                                              be32_to_cpu(reg_entry->reg_type),
                                              be32_to_cpu(reg_entry->reg_num),