m68k: apollo: Replace set but not used variable by READ_ONCE()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Wed, 13 Sep 2023 14:08:15 +0000 (16:08 +0200)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Fri, 6 Oct 2023 08:03:02 +0000 (10:03 +0200)
When building with W=1:

    arch/m68k/apollo/config.c: In function ‘dn_timer_int’:
    arch/m68k/apollo/config.c:171:32: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
      149 |         volatile unsigned char x;
  |                                ^

Fix this by using READ_ONCE(), and removing the variable.
As READ_ONCE() casts to volatile internally, remove the existing cast.
Deduplicate the remaining casts by introducing an intermediary.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/d0299797d6bf747eca2da998c6c6256485a9f52e.1694613528.git.geert@linux-m68k.org
arch/m68k/apollo/config.c

index 0e6801eecbaf6361f9913979cd00bf0d68aa4859..7afefb0191504d4e6d2a4679a0463db6e8d044e2 100644 (file)
@@ -146,13 +146,13 @@ void __init config_apollo(void)
 
 irqreturn_t dn_timer_int(int irq, void *dev_id)
 {
-       volatile unsigned char x;
+       unsigned char *at = (unsigned char *)apollo_timer;
 
        legacy_timer_tick(1);
        timer_heartbeat();
 
-       x = *(volatile unsigned char *)(apollo_timer + 3);
-       x = *(volatile unsigned char *)(apollo_timer + 5);
+       READ_ONCE(*(at + 3));
+       READ_ONCE(*(at + 5));
 
        return IRQ_HANDLED;
 }