* [PATCH] clockevents: timer-stm32: Fix build warning spotted by kbuild test robot
@ 2015-05-27 16:41 Maxime Coquelin
2015-05-27 22:52 ` Luc Van Oostenryck
0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2015-05-27 16:41 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: Thomas Gleixner, linux-kernel, fengguang.wu
This patch fixes below warning spotted by kbuild test robot when building
with ARCH=powerpc:
drivers/clocksource/timer-stm32.c: In function 'stm32_clockevent_init':
>> drivers/clocksource/timer-stm32.c:140:9: warning: large integer implicitly truncated to unsigned type [-Woverflow]
writel_relaxed(~0UL, data->base + TIM_ARR);
The fix consists in casting the value to u32.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
---
drivers/clocksource/timer-stm32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c
index fad2e2e..c9578d8 100644
--- a/drivers/clocksource/timer-stm32.c
+++ b/drivers/clocksource/timer-stm32.c
@@ -137,7 +137,7 @@ static void __init stm32_clockevent_init(struct device_node *np)
}
/* Detect whether the timer is 16 or 32 bits */
- writel_relaxed(~0UL, data->base + TIM_ARR);
+ writel_relaxed((u32)~0UL, data->base + TIM_ARR);
max_delta = readl_relaxed(data->base + TIM_ARR);
if (max_delta == ~0UL) {
prescaler = 1;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] clockevents: timer-stm32: Fix build warning spotted by kbuild test robot
2015-05-27 16:41 [PATCH] clockevents: timer-stm32: Fix build warning spotted by kbuild test robot Maxime Coquelin
@ 2015-05-27 22:52 ` Luc Van Oostenryck
2015-05-28 5:03 ` Maxime Coquelin
0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2015-05-27 22:52 UTC (permalink / raw)
To: Maxime Coquelin
Cc: Daniel Lezcano, Thomas Gleixner, linux-kernel, fengguang.wu
On Wed, May 27, 2015 at 06:41:23PM +0200, Maxime Coquelin wrote:
> This patch fixes below warning spotted by kbuild test robot when building
> with ARCH=powerpc:
>
> drivers/clocksource/timer-stm32.c: In function 'stm32_clockevent_init':
> >> drivers/clocksource/timer-stm32.c:140:9: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> writel_relaxed(~0UL, data->base + TIM_ARR);
>
> The fix consists in casting the value to u32.
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> ---
> drivers/clocksource/timer-stm32.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c
> index fad2e2e..c9578d8 100644
> --- a/drivers/clocksource/timer-stm32.c
> +++ b/drivers/clocksource/timer-stm32.c
> @@ -137,7 +137,7 @@ static void __init stm32_clockevent_init(struct device_node *np)
> }
>
> /* Detect whether the timer is 16 or 32 bits */
> - writel_relaxed(~0UL, data->base + TIM_ARR);
> + writel_relaxed((u32)~0UL, data->base + TIM_ARR);
> max_delta = readl_relaxed(data->base + TIM_ARR);
> if (max_delta == ~0UL) {
> prescaler = 1;
Since the warning come from using a unsigned long constant while
writel() expect an unsigned int, why not simply use ~0U ?
Luc Van Oostenryck
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] clockevents: timer-stm32: Fix build warning spotted by kbuild test robot
2015-05-27 22:52 ` Luc Van Oostenryck
@ 2015-05-28 5:03 ` Maxime Coquelin
0 siblings, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2015-05-28 5:03 UTC (permalink / raw)
To: Luc Van Oostenryck
Cc: Daniel Lezcano, Thomas Gleixner, linux-kernel@vger.kernel.org,
fengguang.wu
2015-05-28 0:52 GMT+02:00 Luc Van Oostenryck <luc.vanoostenryck@gmail.com>:
> On Wed, May 27, 2015 at 06:41:23PM +0200, Maxime Coquelin wrote:
>>
>> /* Detect whether the timer is 16 or 32 bits */
>> - writel_relaxed(~0UL, data->base + TIM_ARR);
>> + writel_relaxed((u32)~0UL, data->base + TIM_ARR);
>> max_delta = readl_relaxed(data->base + TIM_ARR);
>> if (max_delta == ~0UL) {
>> prescaler = 1;
>
>
> Since the warning come from using a unsigned long constant while
> writel() expect an unsigned int, why not simply use ~0U ?
You are right, this is indeed the right fix.
I'm sending the v2 now, using ~0U.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-28 5:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 16:41 [PATCH] clockevents: timer-stm32: Fix build warning spotted by kbuild test robot Maxime Coquelin
2015-05-27 22:52 ` Luc Van Oostenryck
2015-05-28 5:03 ` Maxime Coquelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox