Skip to contentSkip to conversation

wifi: iwlegacy: 3945-rs: remove redundant pointer check in il3945_rs_tx_status() and il3945_rs_get_rate()

PATCH In review Tuo Li 2 participants 2 messages Jan 11 – Jan 12 Intel wireless 3945ABG/bg, 4965AGN (iwlegacy)

lore
Share & tools
lore

Tuo Li

author
#0 lore raw

PATCH v4 1/1 wifi: iwlegacy: 3945-rs: remove redundant pointer check in il3945_rs_tx_status() and il3945_rs_get_rate()

The variable il_sta passed into these two functions cannot be NULL, so remove the related null checks.

---
v4:
* Remove the redundant NULL check instead of using WARN_ON_ONCE(), and update the subject accordingly.
Thanks to Stanislaw Gruszka for helpful advice.
v3:
* Replace plain NULL check with WARN_ON_ONCE() and update subject to better reflect defensive nature of the check.
Thanks to Johannes Berg and Stanislaw Gruszka for helpful advice.
v2:
* Return early for uninitialized STA il data and align D_RATE messages with il3945_rs_tx_status(). Add a wifi: prefix to the patch title. Thanks to Stanislaw Gruszka for the helpful advice.

---
 drivers/net/wireless/intel/iwlegacy/3945-rs.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/wireless/intel/iwlegacy/3945-rs.c +1 -6
index 1826c37c090c..ecc6c8d2a4c5 100644
@@ -448,11 +448,6 @@ il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband,
 		return;
 	}
 
-	if (!il_sta) {
-		D_RATE("leave: No STA il data to update!\n");
-		return;
-	}
-
 	/* Treat uninitialized rate scaling data same as non-existing. */
 	if (!rs_sta->il) {
 		D_RATE("leave: STA il data uninitialized!\n");
@@ -627,7 +622,7 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
 	D_RATE("enter\n");
 
 	/* Treat uninitialized rate scaling data same as non-existing. */
-	if (rs_sta && !rs_sta->il) {
+	if (!rs_sta->il) {
 		D_RATE("Rate scaling information not initialized yet.\n");
 		il_sta = NULL;
 	}
Signature · 1 line
2.43.0
maintainer Acked-by on v4 1/1
#1 lore raw
Quoted 4 lines · Tuo Li

The variable il_sta passed into these two functions cannot be NULL, so remove the related null checks.

Thanks
Stanislaw

Quoted 45 lines

---
v4:
* Remove the redundant NULL check instead of using WARN_ON_ONCE(), and update the subject accordingly.
Thanks to Stanislaw Gruszka for helpful advice.
v3:
* Replace plain NULL check with WARN_ON_ONCE() and update subject to better reflect defensive nature of the check.
Thanks to Johannes Berg and Stanislaw Gruszka for helpful advice.
v2:
* Return early for uninitialized STA il data and align D_RATE messages with il3945_rs_tx_status(). Add a wifi: prefix to the patch title. Thanks to Stanislaw Gruszka for the helpful advice.

---
 drivers/net/wireless/intel/iwlegacy/3945-rs.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/wireless/intel/iwlegacy/3945-rs.c +1 -6
index 1826c37c090c..ecc6c8d2a4c5 100644
@@ -448,11 +448,6 @@ il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband,
 		return;
 	}
 
-	if (!il_sta) {
-		D_RATE("leave: No STA il data to update!\n");
-		return;
-	}
-
 	/* Treat uninitialized rate scaling data same as non-existing. */
 	if (!rs_sta->il) {
 		D_RATE("leave: STA il data uninitialized!\n");
@@ -627,7 +622,7 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
 	D_RATE("enter\n");
 
 	/* Treat uninitialized rate scaling data same as non-existing. */
-	if (rs_sta && !rs_sta->il) {
+	if (!rs_sta->il) {
 		D_RATE("Rate scaling information not initialized yet.\n");
 		il_sta = NULL;
 	}
Signature · 1 line
2.43.0