2023-12-27 14:36:39

by Daniel Lezcano

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

All warnings (new ones prefixed by >>):

drivers/clocksource/timer-imx-gpt.c: In function 'mxc_timer_interrupt':
>> drivers/clocksource/timer-imx-gpt.c:279:18: warning: variable 'tstat' set but not used [-Wunused-but-set-variable]
279 | uint32_t tstat;
| ^~~~~

vim +/tstat +279 drivers/clocksource/timer-imx-gpt.c

The change remove the tstats assignment but not the reading of the
register, assuming the register may be a ROR (Reset On Read) which
happens in the driver's interrupt registers.

Fixes: df181e382816 ("clocksource/drivers/imx-gpt: Add support for ARM64")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/clocksource/timer-imx-gpt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
index 6a878d227a13..489e69169ed4 100644
--- a/drivers/clocksource/timer-imx-gpt.c
+++ b/drivers/clocksource/timer-imx-gpt.c
@@ -258,9 +258,8 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
{
struct clock_event_device *ced = dev_id;
struct imx_timer *imxtm = to_imx_timer(ced);
- uint32_t tstat;

- tstat = readl_relaxed(imxtm->base + imxtm->gpt->reg_tstat);
+ readl_relaxed(imxtm->base + imxtm->gpt->reg_tstat);

imxtm->gpt->gpt_irq_acknowledge(imxtm);

--
2.34.1



2024-03-18 10:14:07

by tip-bot2 for Jacob Pan

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

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

Commit-ID: bf3159c0ef1fd2bc999e3a4910b1c610949ae333
Gitweb: https://git.kernel.org/tip/bf3159c0ef1fd2bc999e3a4910b1c610949ae333
Author: Daniel Lezcano <[email protected]>
AuthorDate: Wed, 27 Dec 2023 15:35:46 +01:00
Committer: Daniel Lezcano <[email protected]>
CommitterDate: Mon, 22 Jan 2024 13:11:02 +01:00

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

All warnings (new ones prefixed by >>):

drivers/clocksource/timer-imx-gpt.c: In function 'mxc_timer_interrupt':
>> drivers/clocksource/timer-imx-gpt.c:279:18: warning: variable 'tstat' set but not used [-Wunused-but-set-variable]
279 | uint32_t tstat;
| ^~~~~

vim +/tstat +279 drivers/clocksource/timer-imx-gpt.c

The change remove the tstats assignment but not the reading of the
register, assuming the register may be a ROR (Reset On Read) which
happens in the driver's interrupt registers.

Fixes: df181e382816 ("clocksource/drivers/imx-gpt: Add support for ARM64")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Daniel Lezcano <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
drivers/clocksource/timer-imx-gpt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
index 6a878d2..489e691 100644
--- a/drivers/clocksource/timer-imx-gpt.c
+++ b/drivers/clocksource/timer-imx-gpt.c
@@ -258,9 +258,8 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
{
struct clock_event_device *ced = dev_id;
struct imx_timer *imxtm = to_imx_timer(ced);
- uint32_t tstat;

- tstat = readl_relaxed(imxtm->base + imxtm->gpt->reg_tstat);
+ readl_relaxed(imxtm->base + imxtm->gpt->reg_tstat);

imxtm->gpt->gpt_irq_acknowledge(imxtm);