git: 7bb21369905a - stable/13 - bwn: eliminate dead writes in BWN_GPL_PHY

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 12 May 2022 12:56:23 UTC
The branch stable/13 has been updated by markj:

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

commit 7bb21369905af0136102fd5dcd0f0b8577181a01
Author:     Greg V <greg@unrelenting.technology>
AuthorDate: 2022-05-04 13:32:59 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-12 12:56:04 +0000

    bwn: eliminate dead writes in BWN_GPL_PHY
    
    This fixes the newly Werror'ed useless write warnings with options
    BWN_GPL_PHY.
    
    Reviewed by:    markj
    
    (cherry picked from commit 12905b7d50289633a58caf34ba77ff318ba4f0c2)
---
 sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c   |  4 ----
 sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c | 11 ++++++++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
index f93b7af26877..6b47a5990d3b 100644
--- a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
+++ b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
@@ -6070,7 +6070,6 @@ bwn_nphy_op_recalc_txpower(struct bwn_mac *mac, bool ignore_tssi)
 	struct bwn_softc *sc = mac->mac_sc;
 	struct bwn_ppr *ppr = &nphy->tx_pwr_max_ppr;
 	uint8_t max; /* qdBm */
-	bool tx_pwr_state;
 
 	if (nphy->tx_pwr_last_recalc_freq == bwn_get_centre_freq(mac) &&
 	    nphy->tx_pwr_last_recalc_limit == phy->txpower)
@@ -6108,7 +6107,6 @@ bwn_nphy_op_recalc_txpower(struct bwn_mac *mac, bool ignore_tssi)
 	bwn_ppr_apply_min(mac, ppr, INT_TO_Q52(8));
 
 	/* Apply */
-	tx_pwr_state = nphy->txpwrctrl;
 	bwn_mac_suspend(mac);
 	bwn_nphy_tx_power_ctl_setup(mac);
 	if (bhnd_get_hwrev(sc->sc_dev) == 11 || bhnd_get_hwrev(sc->sc_dev) == 12) {
@@ -6214,7 +6212,6 @@ static int bwn_phy_initn(struct bwn_mac *mac)
 	struct bwn_nphy_txgains target;
 	int error;
 	uint16_t tmp;
-	bwn_band_t tmp2;
 	bool do_rssi_cal;
 
 	uint16_t clip[2];
@@ -6308,7 +6305,6 @@ static int bwn_phy_initn(struct bwn_mac *mac)
 		BWN_PHY_WRITE(mac, BWN_NPHY_DUP40_BL, 0x9A4);
 	}
 
-	tmp2 = bwn_current_band(mac);
 	if (bwn_nphy_ipa(mac)) {
 		BWN_PHY_SET(mac, BWN_NPHY_PAPD_EN0, 0x1);
 		BWN_PHY_SETMASK(mac, BWN_NPHY_EPS_TABLE_ADJ0, 0x007F,
diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c
index b59271f65933..c1fc199b75d4 100644
--- a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c
+++ b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c
@@ -3454,10 +3454,15 @@ void bwn_ntab_read_bulk(struct bwn_mac *mac, uint32_t offset,
 
 void bwn_ntab_write(struct bwn_mac *mac, uint32_t offset, uint32_t value)
 {
-	uint32_t type, orig;
+	uint32_t type;
+#ifdef INVARIANTS
+	uint32_t orig;
+#endif
 
 	type = offset & BWN_NTAB_TYPEMASK;
+#ifdef INVARIANTS
 	orig = offset;
+#endif
 	offset &= 0xFFFF;
 
 	switch (type) {
@@ -3494,12 +3499,16 @@ void bwn_ntab_write_bulk(struct bwn_mac *mac, uint32_t offset,
 {
 	struct bwn_softc *sc = mac->mac_sc;
 	uint32_t type, value;
+#ifdef INVARIANTS
 	uint32_t orig;
+#endif
 	const uint8_t *data = _data;
 	unsigned int i;
 
 	type = offset & BWN_NTAB_TYPEMASK;
+#ifdef INVARIANTS
 	orig = offset;
+#endif
 	offset &= ~BWN_NTAB_TYPEMASK;
 	KASSERT(offset <= 0xFFFF, ("%s: invalid offset (%d)\n",
 	    __func__, offset));