From: Arnd Bergmann <arnd@arndb.de>
Passing an 8-bit constant into delay() triggers a warning when building
with 'make W=1' using clang:
drivers/clk/actions/owl-pll.c:182:2: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
udelay(pll_hw->delay);
^~~~~~~~~~~~~~~~~~~~~
arch/arm/include/asm/delay.h:84:9: note: expanded from macro 'udelay'
((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
arch/arm/mach-omap2/wd_timer.c:89:3: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
udelay(oh->class->sysc->srst_udelay);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shut up the warning by adding a cast to a 64-bit number. A cast to 'int'
would usually be sufficient, but would fail to cause a link-time error
for large 64-bit constants.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/include/asm/delay.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk> Date: 2021-03-23 13:31:11
On Tue, Mar 23, 2021 at 02:20:23PM +0100, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@arndb.de>
Passing an 8-bit constant into delay() triggers a warning when building
with 'make W=1' using clang:
drivers/clk/actions/owl-pll.c:182:2: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
udelay(pll_hw->delay);
^~~~~~~~~~~~~~~~~~~~~
arch/arm/include/asm/delay.h:84:9: note: expanded from macro 'udelay'
((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
arch/arm/mach-omap2/wd_timer.c:89:3: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
udelay(oh->class->sysc->srst_udelay);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shut up the warning by adding a cast to a 64-bit number. A cast to 'int'
would usually be sufficient, but would fail to cause a link-time error
for large 64-bit constants.
From: David Laight <hidden> Date: 2021-03-24 23:15:47
From: Arnd Bergmann
Sent: 23 March 2021 13:20
Passing an 8-bit constant into delay() triggers a warning when building
with 'make W=1' using clang:
drivers/clk/actions/owl-pll.c:182:2: error: result of comparison of constant 2000 with expression of
type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
udelay(pll_hw->delay);
^~~~~~~~~~~~~~~~~~~~~
arch/arm/include/asm/delay.h:84:9: note: expanded from macro 'udelay'
((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
arch/arm/mach-omap2/wd_timer.c:89:3: error: result of comparison of constant 2000 with expression of
type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
udelay(oh->class->sysc->srst_udelay);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shut up the warning by adding a cast to a 64-bit number. A cast to 'int'
would usually be sufficient, but would fail to cause a link-time error
for large 64-bit constants.
Adding 0u probably has the desired effect - without any side effects of a cast.
David