public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] wifi: iwlegacy: 3945-rs: add a defensive WARN_ON_ONCE for il_sta in il3945_rs_get_rate()
@ 2026-01-09  3:40 Tuo Li
  2026-01-09  9:02 ` Stanislaw Gruszka
  0 siblings, 1 reply; 5+ messages in thread
From: Tuo Li @ 2026-01-09  3:40 UTC (permalink / raw)
  To: stf_xl; +Cc: linux-wireless, linux-kernel, Tuo Li

In this function, il_sta is not expected to be NULL. Add a defensive
WARN_ON_ONCE() to catch this unexpected condition and aid debugging.

Signed-off-by: Tuo Li <islituo@gmail.com>
---
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 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
index 1826c37c090c..463565ce14af 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
@@ -626,6 +626,9 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
 
 	D_RATE("enter\n");
 
+	if (WARN_ON_ONCE(!il_sta))
+		return;
+
 	/* Treat uninitialized rate scaling data same as non-existing. */
 	if (rs_sta && !rs_sta->il) {
 		D_RATE("Rate scaling information not initialized yet.\n");
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-10 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09  3:40 [PATCH v3] wifi: iwlegacy: 3945-rs: add a defensive WARN_ON_ONCE for il_sta in il3945_rs_get_rate() Tuo Li
2026-01-09  9:02 ` Stanislaw Gruszka
2026-01-09 15:12   ` Tuo Li
2026-01-09 20:42     ` Stanislaw Gruszka
2026-01-10 13:49       ` Tuo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox