diff options
author | John Baldwin <jhb@FreeBSD.org> | 2022-10-06 02:46:01 +0300 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2022-11-11 21:18:54 +0300 |
commit | 587ab8e01930bb7196f55227cec263827165fc3f (patch) | |
tree | 54b714cca6764387e55596748819347a658927b3 | |
parent | d77e67e9d5e40910e11a89b7ff7b3570a5e0965f (diff) |
msk: Use a void cast to mark values of dummy reads as unused.
Note that this required adding missing ()'s around the outermost level
of MSK_READ_MIB*. Otherwise, the void cast was only applied to the
first register read. This also meant that MSK_READ_MIB64 was pretty
broken as the uint64_t cast only applied to the first 16-bit register
read in each MSK_READ_MIB32 invocation and the 32-bit shift was only
applied to the second register read of the pair.
Reviewed by: imp, emaste
Reported by: GCC -Wunused-value
Differential Revision: https://reviews.freebsd.org/D36777
(cherry picked from commit ae70e8838c6673850098530f23ce1521328f983c)
-rw-r--r-- | sys/dev/msk/if_msk.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c index 729d8383e9c1..857cfb9a0975 100644 --- a/sys/dev/msk/if_msk.c +++ b/sys/dev/msk/if_msk.c @@ -4301,11 +4301,11 @@ msk_stop(struct msk_if_softc *sc_if) * lower 16 bits should be the last operation. */ #define MSK_READ_MIB32(x, y) \ - (((uint32_t)GMAC_READ_2(sc, x, (y) + 4)) << 16) + \ - (uint32_t)GMAC_READ_2(sc, x, y) + ((((uint32_t)GMAC_READ_2(sc, x, (y) + 4)) << 16) + \ + (uint32_t)GMAC_READ_2(sc, x, y)) #define MSK_READ_MIB64(x, y) \ - (((uint64_t)MSK_READ_MIB32(x, (y) + 8)) << 32) + \ - (uint64_t)MSK_READ_MIB32(x, y) + ((((uint64_t)MSK_READ_MIB32(x, (y) + 8)) << 32) + \ + (uint64_t)MSK_READ_MIB32(x, y)) static void msk_stats_clear(struct msk_if_softc *sc_if) @@ -4322,7 +4322,7 @@ msk_stats_clear(struct msk_if_softc *sc_if) GMAC_WRITE_2(sc, sc_if->msk_port, GM_PHY_ADDR, gmac | GM_PAR_MIB_CLR); /* Read all MIB Counters with Clear Mode set. */ for (i = GM_RXF_UC_OK; i <= GM_TXE_FIFO_UR; i += sizeof(uint32_t)) - MSK_READ_MIB32(sc_if->msk_port, i); + (void)MSK_READ_MIB32(sc_if->msk_port, i); /* Clear MIB Clear Counter Mode. */ gmac &= ~GM_PAR_MIB_CLR; GMAC_WRITE_2(sc, sc_if->msk_port, GM_PHY_ADDR, gmac); |