Since 'tx_rx_cal_radio_saveregs[]' of 'struct brcms_phy' is 'u16', 'pi->tx_rx_cal_radio_saveregs[2] & 0xF0) >> 8' is always zero, so a few duplicated snippets in 'wlc_phy_rxcal_radio_setup_nphy()' may be reduced to compile-time constant (in fact, the same thing is actually done by both gcc and clang I've tried). Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Reported-by: Colin King <colin.i.king@xxxxxxxxx> Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx> --- v2: add Reported-by: as suggested by Arend --- .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 44 ++----------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c index d69879e1bd87..48343c820422 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c @@ -26201,7 +26201,6 @@ static void wlc_phy_calc_rx_iq_comp_nphy(struct brcms_phy *pi, u8 core_mask) static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) { - u16 offtune_val; u16 bias_g = 0; u16 bias_a = 0; @@ -26322,17 +26321,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) read_radio_reg(pi, RADIO_2056_RX_LNAA_TUNE | RADIO_2056_RX0); - - offtune_val = - (pi->tx_rx_cal_radio_saveregs - [2] & 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAA_TUNE | - RADIO_2056_RX0, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX0, 0xF0, 0xF00); } write_radio_reg(pi, @@ -26372,18 +26363,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX0); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | - RADIO_2056_RX0, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX0, 0xF0, 0xF00); } write_radio_reg(pi, @@ -26446,18 +26428,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) pi, RADIO_2056_RX_LNAA_TUNE | RADIO_2056_RX1); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAA_TUNE | - RADIO_2056_RX1, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX1, 0xF0, 0xF00); } write_radio_reg(pi, @@ -26496,18 +26469,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX1); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | - RADIO_2056_RX1, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX1, 0xF0, 0xF00); } write_radio_reg(pi, -- 2.47.0