[PATCH 4/4] powerpc/sparse: Use LE definition of REG_BYTE

Daniel Axtens dja at axtens.net
Wed May 18 11:16:52 AEST 2016

Sparse complains that it doesn't know what REG_BYTE is:

arch/powerpc/kernel/align.c:313:29: error: undefined identifier 'REG_BYTE'
arch/powerpc/kernel/align.c:320:37: error: undefined identifier 'REG_BYTE'
arch/powerpc/kernel/align.c:328:29: error: cast from unknown type
arch/powerpc/kernel/align.c:328:29: error: cast from unknown type

REG_BYTE is defined differently based on whether we're compiling for
LE, BE32 or BE64. Sparse apparently doesn't provide __BIG_ENDIAN__
or __LITTLE_ENDIAN__, so add an explicit __CHECKER__ to the LE

The choice of LE is arbitrary.

Signed-off-by: Daniel Axtens <dja at axtens.net>
 arch/powerpc/kernel/align.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 8e7cb8e2b21a..43f745f2cea9 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -230,7 +230,7 @@ static int emulate_dcbz(struct pt_regs *regs, unsigned char __user *addr)
-#ifdef __LITTLE_ENDIAN__
+#if defined(__LITTLE_ENDIAN__) || defined(__CHECKER__)
 #define REG_BYTE(rp, i)		(*(((u8 *)((rp) + ((i)>>2)) + ((i)&3))))

More information about the Linuxppc-dev mailing list