diff mbox

[kvm-unit-tests,v3,03/17] lib: asm-generic: add missing casts

Message ID 1455380910-30604-4-git-send-email-drjones@redhat.com
State Superseded
Headers show

Commit Message

Andrew Jones Feb. 13, 2016, 4:28 p.m. UTC
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/asm-generic/io.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

David Gibson Feb. 14, 2016, 10:57 p.m. UTC | #1
On Sat, Feb 13, 2016 at 05:28:16PM +0100, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  lib/asm-generic/io.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h
> index a9939d3a5921f..931415a465b74 100644
> --- a/lib/asm-generic/io.h
> +++ b/lib/asm-generic/io.h
> @@ -104,27 +104,27 @@ static inline u64 __bswap64(u64 x)
>  #endif
>  
>  #define le16_to_cpu(x) \
> -	({ u16 __r = __cpu_is_be() ? __bswap16(x) : (x); __r; })
> +	({ u16 __r = __cpu_is_be() ? __bswap16(x) : ((u16)x); __r; })
>  #define cpu_to_le16 le16_to_cpu
>  
>  #define le32_to_cpu(x) \
> -	({ u32 __r = __cpu_is_be() ? __bswap32(x) : (x); __r; })
> +	({ u32 __r = __cpu_is_be() ? __bswap32(x) : ((u32)x); __r; })
>  #define cpu_to_le32 le32_to_cpu
>  
>  #define le64_to_cpu(x) \
> -	({ u64 __r = __cpu_is_be() ? __bswap64(x) : (x); __r; })
> +	({ u64 __r = __cpu_is_be() ? __bswap64(x) : ((u64)x); __r; })
>  #define cpu_to_le64 le64_to_cpu
>  
>  #define be16_to_cpu(x) \
> -	({ u16 __r = !__cpu_is_be() ? __bswap16(x) : (x); __r; })
> +	({ u16 __r = !__cpu_is_be() ? __bswap16(x) : ((u16)x); __r; })
>  #define cpu_to_be16 be16_to_cpu
>  
>  #define be32_to_cpu(x) \
> -	({ u32 __r = !__cpu_is_be() ? __bswap32(x) : (x); __r; })
> +	({ u32 __r = !__cpu_is_be() ? __bswap32(x) : ((u32)x); __r; })
>  #define cpu_to_be32 be32_to_cpu
>  
>  #define be64_to_cpu(x) \
> -	({ u64 __r = !__cpu_is_be() ? __bswap64(x) : (x); __r; })
> +	({ u64 __r = !__cpu_is_be() ? __bswap64(x) : ((u64)x); __r; })
>  #define cpu_to_be64 be64_to_cpu
>  
>  #ifndef rmb
diff mbox

Patch

diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h
index a9939d3a5921f..931415a465b74 100644
--- a/lib/asm-generic/io.h
+++ b/lib/asm-generic/io.h
@@ -104,27 +104,27 @@  static inline u64 __bswap64(u64 x)
 #endif
 
 #define le16_to_cpu(x) \
-	({ u16 __r = __cpu_is_be() ? __bswap16(x) : (x); __r; })
+	({ u16 __r = __cpu_is_be() ? __bswap16(x) : ((u16)x); __r; })
 #define cpu_to_le16 le16_to_cpu
 
 #define le32_to_cpu(x) \
-	({ u32 __r = __cpu_is_be() ? __bswap32(x) : (x); __r; })
+	({ u32 __r = __cpu_is_be() ? __bswap32(x) : ((u32)x); __r; })
 #define cpu_to_le32 le32_to_cpu
 
 #define le64_to_cpu(x) \
-	({ u64 __r = __cpu_is_be() ? __bswap64(x) : (x); __r; })
+	({ u64 __r = __cpu_is_be() ? __bswap64(x) : ((u64)x); __r; })
 #define cpu_to_le64 le64_to_cpu
 
 #define be16_to_cpu(x) \
-	({ u16 __r = !__cpu_is_be() ? __bswap16(x) : (x); __r; })
+	({ u16 __r = !__cpu_is_be() ? __bswap16(x) : ((u16)x); __r; })
 #define cpu_to_be16 be16_to_cpu
 
 #define be32_to_cpu(x) \
-	({ u32 __r = !__cpu_is_be() ? __bswap32(x) : (x); __r; })
+	({ u32 __r = !__cpu_is_be() ? __bswap32(x) : ((u32)x); __r; })
 #define cpu_to_be32 be32_to_cpu
 
 #define be64_to_cpu(x) \
-	({ u64 __r = !__cpu_is_be() ? __bswap64(x) : (x); __r; })
+	({ u64 __r = !__cpu_is_be() ? __bswap64(x) : ((u64)x); __r; })
 #define cpu_to_be64 be64_to_cpu
 
 #ifndef rmb