Skip to contentSkip to conversation

staging: fbtft: Fix endian sparse warnings

PATCH In review Amitoj Kaur Chawla 2 participants 2 messages Oct 21, 2015 – Oct 25, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: fbtft: Fix endian sparse warnings

Fix a bug found using sparse which generates the following warnings:

drivers/staging/fbtft/fbtft-io.c:78:29: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fbtft-io.c:78:29: expected unsigned long long [unsigned] [long] [long long] [usertype] <noident> drivers/staging/fbtft/fbtft-io.c:78:29: got restricted __be64 [usertype] <noident>

---
 drivers/staging/fbtft/fbtft-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-io.c +1 -1
index a6f091f..a9a46c2 100644
@@ -75,7 +75,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len)
 			src++;
 		}
 		tmp |= ((*src & 0x0100) ? 1 : 0);
-		*(u64 *)dst = cpu_to_be64(tmp);
+		*(__be64 *)dst = cpu_to_be64(tmp);
 		dst += 8;
 		*dst++ = (u8)(*src++ & 0x00FF);
 		added++;
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 19 lines · Amitoj Kaur Chawla

Fix a bug found using sparse which generates the following warnings:

drivers/staging/fbtft/fbtft-io.c:78:29: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fbtft-io.c:78:29: expected unsigned long long [unsigned] [long] [long long] [usertype] <noident> drivers/staging/fbtft/fbtft-io.c:78:29: got restricted __be64 [usertype] <noident>

---
 drivers/staging/fbtft/fbtft-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-io.c +0 -0
index a6f091f..a9a46c2 100644

drivers/staging/fbtft/fbtft-io.c int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len) · line 78

Quoted 5 lines
drivers/staging/fbtft/fbtft-io.c +1 -1
@@ -75,7 +75,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len)
 			src++;
 		}
 		tmp |= ((*src & 0x0100) ? 1 : 0);
-		*(u64 *)dst = cpu_to_be64(tmp);
+		*(__be64 *)dst = cpu_to_be64(tmp);

Are you sure this is correct? Why isn't dst declared as be64 to start with? And don't use the __ form of variables unless they are crossing the user/kernel boundry in a structure somehow.

thanks,

greg k-h