All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: mvebu: avoid clang -Wtautological-constant warning
@ 2021-03-23 13:19 Arnd Bergmann
  2021-03-23 18:39 ` Nathan Chancellor
  2021-04-01 10:23 ` Arnd Bergmann
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-03-23 13:19 UTC (permalink / raw)
  To: Andrew Lunn, Gregory Clement
  Cc: soc, Arnd Bergmann, Nathan Chancellor, Nick Desaulniers,
	Mike Rapoport, Andrew Morton, Chris Packham, Thomas Petazzoni,
	linux-kernel, clang-built-linux

From: Arnd Bergmann <arnd@arndb.de>

Clang warns about the comparison when using a 32-bit phys_addr_t:

drivers/bus/mvebu-mbus.c:621:17: error: result of comparison of constant 4294967296 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
                if (reg_start >= 0x100000000ULL)

Add a cast to shut up the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/bus/mvebu-mbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index dd9e7343a5e3..ea0424922de7 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -618,7 +618,7 @@ mvebu_mbus_find_bridge_hole(uint64_t *start, uint64_t *end)
 		 * This part of the memory is above 4 GB, so we don't
 		 * care for the MBus bridge hole.
 		 */
-		if (reg_start >= 0x100000000ULL)
+		if ((u64)reg_start >= 0x100000000ULL)
 			continue;
 
 		/*
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: mvebu: avoid clang -Wtautological-constant warning
  2021-03-23 13:19 [PATCH] ARM: mvebu: avoid clang -Wtautological-constant warning Arnd Bergmann
@ 2021-03-23 18:39 ` Nathan Chancellor
  2021-04-01 10:23 ` Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2021-03-23 18:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Andrew Lunn, Gregory Clement, soc, Arnd Bergmann,
	Nick Desaulniers, Mike Rapoport, Andrew Morton, Chris Packham,
	Thomas Petazzoni, linux-kernel, clang-built-linux

On Tue, Mar 23, 2021 at 02:19:42PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Clang warns about the comparison when using a 32-bit phys_addr_t:
> 
> drivers/bus/mvebu-mbus.c:621:17: error: result of comparison of constant 4294967296 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>                 if (reg_start >= 0x100000000ULL)
> 
> Add a cast to shut up the warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/bus/mvebu-mbus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index dd9e7343a5e3..ea0424922de7 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -618,7 +618,7 @@ mvebu_mbus_find_bridge_hole(uint64_t *start, uint64_t *end)
>  		 * This part of the memory is above 4 GB, so we don't
>  		 * care for the MBus bridge hole.
>  		 */
> -		if (reg_start >= 0x100000000ULL)
> +		if ((u64)reg_start >= 0x100000000ULL)
>  			continue;
>  
>  		/*
> -- 
> 2.29.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: mvebu: avoid clang -Wtautological-constant warning
  2021-03-23 13:19 [PATCH] ARM: mvebu: avoid clang -Wtautological-constant warning Arnd Bergmann
  2021-03-23 18:39 ` Nathan Chancellor
@ 2021-04-01 10:23 ` Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-04-01 10:23 UTC (permalink / raw)
  To: Arnd Bergmann, Andrew Lunn, Gregory Clement
  Cc: Arnd Bergmann, Thomas Petazzoni, linux-kernel, Chris Packham,
	Nick Desaulniers, soc, Mike Rapoport, Andrew Morton,
	clang-built-linux, Nathan Chancellor

From: Arnd Bergmann <arnd@arndb.de>

On Tue, 23 Mar 2021 14:19:42 +0100, Arnd Bergmann wrote:
> Clang warns about the comparison when using a 32-bit phys_addr_t:
> 
> drivers/bus/mvebu-mbus.c:621:17: error: result of comparison of constant 4294967296 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>                 if (reg_start >= 0x100000000ULL)
> 
> Add a cast to shut up the warning.

Applied to arm/fixes.

[1/1] ARM: mvebu: avoid clang -Wtautological-constant warning
      commit: da03f523e83350caf2cf12f1169eca129efc445a

       Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-01 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 13:19 [PATCH] ARM: mvebu: avoid clang -Wtautological-constant warning Arnd Bergmann
2021-03-23 18:39 ` Nathan Chancellor
2021-04-01 10:23 ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.