git: 587ab8e01930 - stable/13 - msk: Use a void cast to mark values of dummy reads as unused.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Nov 2022 18:37:04 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=587ab8e01930bb7196f55227cec263827165fc3f commit 587ab8e01930bb7196f55227cec263827165fc3f Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-10-05 23:46:01 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-11-11 18:18:54 +0000 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) --- sys/dev/msk/if_msk.c | 10 +++++----- 1 file 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);