2021-11-23 19:25:43

by Drew Fustini

[permalink] [raw]
Subject: [PATCH] clocksource/drivers/pistachio: Fix -Wunused-but-set-variable warning

Variable 'overflow' set but not used, but this is the intended behavior.
The hardware only updates the counter register after the overflow
register read. However, the value of overflow is not actually needed.

Link: https://lore.kernel.org/lkml/[email protected]/
Reported-by: kernel test robot <[email protected]>
Suggested-by: Daniel Lezcano <[email protected]>
Signed-off-by: Drew Fustini <[email protected]>
---
drivers/clocksource/timer-pistachio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-pistachio.c b/drivers/clocksource/timer-pistachio.c
index 6f37181a8c63..69c069e6f0a2 100644
--- a/drivers/clocksource/timer-pistachio.c
+++ b/drivers/clocksource/timer-pistachio.c
@@ -71,7 +71,8 @@ static u64 notrace
pistachio_clocksource_read_cycles(struct clocksource *cs)
{
struct pistachio_clocksource *pcs = to_pistachio_clocksource(cs);
- u32 counter, overflow;
+ __maybe_unused u32 overflow;
+ u32 counter;
unsigned long flags;

/*
--
2.27.0



2021-12-09 13:16:53

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] clocksource/drivers/pistachio: Fix -Wunused-but-set-variable warning

On 23/11/2021 20:25, Drew Fustini wrote:
> Variable 'overflow' set but not used, but this is the intended behavior.
> The hardware only updates the counter register after the overflow
> register read. However, the value of overflow is not actually needed.
>
> Link: https://lore.kernel.org/lkml/[email protected]/
> Reported-by: kernel test robot <[email protected]>
> Suggested-by: Daniel Lezcano <[email protected]>
> Signed-off-by: Drew Fustini <[email protected]>
> ---

Applied, thanks

-- Daniel


--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Subject: [tip: timers/core] clocksource/drivers/pistachio: Fix -Wunused-but-set-variable warning

The following commit has been merged into the timers/core branch of tip:

Commit-ID: 0642fb4ba68f7158f7a6d92190b3090cf0c7fac6
Gitweb: https://git.kernel.org/tip/0642fb4ba68f7158f7a6d92190b3090cf0c7fac6
Author: Drew Fustini <[email protected]>
AuthorDate: Tue, 23 Nov 2021 11:25:24 -08:00
Committer: Daniel Lezcano <[email protected]>
CommitterDate: Tue, 14 Dec 2021 10:17:36 +01:00

clocksource/drivers/pistachio: Fix -Wunused-but-set-variable warning

Variable 'overflow' set but not used, but this is the intended behavior.
The hardware only updates the counter register after the overflow
register read. However, the value of overflow is not actually needed.

Link: https://lore.kernel.org/lkml/[email protected]/
Reported-by: kernel test robot <[email protected]>
Suggested-by: Daniel Lezcano <[email protected]>
Signed-off-by: Drew Fustini <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/clocksource/timer-pistachio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-pistachio.c b/drivers/clocksource/timer-pistachio.c
index 6f37181..69c069e 100644
--- a/drivers/clocksource/timer-pistachio.c
+++ b/drivers/clocksource/timer-pistachio.c
@@ -71,7 +71,8 @@ static u64 notrace
pistachio_clocksource_read_cycles(struct clocksource *cs)
{
struct pistachio_clocksource *pcs = to_pistachio_clocksource(cs);
- u32 counter, overflow;
+ __maybe_unused u32 overflow;
+ u32 counter;
unsigned long flags;

/*