linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: fsl: avoid harmless 64-bit warnings
@ 2015-11-16 16:34 Arnd Bergmann
  2015-11-17  9:37 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2015-11-16 16:34 UTC (permalink / raw)
  To: linux-arm-kernel

The ftm_clockevent_init passes the value of "~0UL" into a function
that takes a 32-bit argument, which drops the upper 32 bits, as
gcc warns about on ARM64:

clocksource/fsl_ftm_timer.c: In function 'ftm_clockevent_init':
clocksource/fsl_ftm_timer.c:206:13: warning: large integer implicitly truncated to unsigned type [-Woverflow]

This was obviously unintended behavior, and is easily avoided by
using '~0u' as the integer literal, because that is 32-bit wide
on all architectures.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
index 10202f1fdfd7..517e1c7624d4 100644
--- a/drivers/clocksource/fsl_ftm_timer.c
+++ b/drivers/clocksource/fsl_ftm_timer.c
@@ -203,7 +203,7 @@ static int __init ftm_clockevent_init(unsigned long freq, int irq)
 	int err;
 
 	ftm_writel(0x00, priv->clkevt_base + FTM_CNTIN);
-	ftm_writel(~0UL, priv->clkevt_base + FTM_MOD);
+	ftm_writel(~0u, priv->clkevt_base + FTM_MOD);
 
 	ftm_reset_counter(priv->clkevt_base);
 
@@ -230,7 +230,7 @@ static int __init ftm_clocksource_init(unsigned long freq)
 	int err;
 
 	ftm_writel(0x00, priv->clksrc_base + FTM_CNTIN);
-	ftm_writel(~0UL, priv->clksrc_base + FTM_MOD);
+	ftm_writel(~0u, priv->clksrc_base + FTM_MOD);
 
 	ftm_reset_counter(priv->clksrc_base);
 

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

* [PATCH] clocksource: fsl: avoid harmless 64-bit warnings
  2015-11-16 16:34 [PATCH] clocksource: fsl: avoid harmless 64-bit warnings Arnd Bergmann
@ 2015-11-17  9:37 ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2015-11-17  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/16/2015 05:34 PM, Arnd Bergmann wrote:
> The ftm_clockevent_init passes the value of "~0UL" into a function
> that takes a 32-bit argument, which drops the upper 32 bits, as
> gcc warns about on ARM64:
>
> clocksource/fsl_ftm_timer.c: In function 'ftm_clockevent_init':
> clocksource/fsl_ftm_timer.c:206:13: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>
> This was obviously unintended behavior, and is easily avoided by
> using '~0u' as the integer literal, because that is 32-bit wide
> on all architectures.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks Arnd for the fix. I will apply it on top of branch.

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

end of thread, other threads:[~2015-11-17  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-16 16:34 [PATCH] clocksource: fsl: avoid harmless 64-bit warnings Arnd Bergmann
2015-11-17  9:37 ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).