staging: fbtft: Fix endian sparse warnings
Subsystems (2)
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
@@ -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
Greg KH
maintainerQuoted 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>Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/fbtft/fbtft-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/fbtft/fbtft-io.c +0
-0
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