git: ae70e8838c66 - main - msk: Use a void cast to mark values of dummy reads as unused.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 05 Oct 2022 23:48:30 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae70e8838c6673850098530f23ce1521328f983c

commit ae70e8838c6673850098530f23ce1521328f983c
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-10-05 23:46:01 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-10-05 23:46:01 +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
---
 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 15b9131a2c79..7277a8407fcc 100644
--- a/sys/dev/msk/if_msk.c
+++ b/sys/dev/msk/if_msk.c
@@ -4297,11 +4297,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)
@@ -4318,7 +4318,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);