Skip to contentSkip to conversation

brcm80211: remove an unneeded NULL check

PATCH In review Dan Carpenter 2 participants 2 messages May 14, 2012 – May 15, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcm80211: remove an unneeded NULL check

This code causes a static checker warning because "pi" gets dereferenced before it is checked. The dereference is inside the write_phy_reg() function which is called from wlc_phy_write_txmacreg_nphy().

This code is only called from wlc_phy_init_nphy() and "pi" is a valid pointer so we can remove the check for NULL.

drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c +1 -1
index 812b6e3..d6380f3 100644
@@ -14358,7 +14358,7 @@ void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs)
 
 	wlc_phy_write_txmacreg_nphy(pi, holdoff, delay);
 
-	if (pi && pi->sh && (pi->sh->_rifs_phy != rifs))
+	if (pi->sh && (pi->sh->_rifs_phy != rifs))
 		pi->sh->_rifs_phy = rifs;
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

This code causes a static checker warning because "pi" gets dereferenced before it is checked. The dereference is inside the write_phy_reg() function which is called from wlc_phy_write_txmacreg_nphy().

This code is only called from wlc_phy_init_nphy() and "pi" is a valid pointer so we can remove the check for NULL.

Quoted 16 lines
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c +1 -1
index 812b6e3..d6380f3 100644
@@ -14358,7 +14358,7 @@ void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs)
 
 	wlc_phy_write_txmacreg_nphy(pi, holdoff, delay);
 
-	if (pi && pi->sh && (pi->sh->_rifs_phy != rifs))
+	if (pi->sh && (pi->sh->_rifs_phy != rifs))
 		pi->sh->_rifs_phy = rifs;
 }