From 1ba5cc4b4023effc234869f1bef6d43905a9fede Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 1 Jun 2026 11:45:37 +0000 Subject: [PATCH] wifi: mt76: mt7925: drop redundant chandef.chan NULL check in MT7927 path In mt7925_mac_link_bss_add(), the MT7927 branch added an else-if that checked mvif->phy->mt76->chandef.chan before assigning it to the local chan pointer. If that check failed, chan stayed NULL and chan->band was dereferenced unconditionally a line later. phy->chandef.chan is set during phy registration in mt76_check_sband() and is never cleared, so the check is a no-op. Drop it and use the chandef channel as an unconditional fallback, matching the assumption made elsewhere in the driver (e.g. the existing basic_rates_idx selection right below this block and mt7925/mac.c). Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202606011203.GwBe93Bo-lkp@intel.com/ Signed-off-by: Felix Fietkau --- mt7925/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mt7925/main.c b/mt7925/main.c index 26c17b89..c20e5316 100644 --- a/mt7925/main.c +++ b/mt7925/main.c @@ -398,11 +398,11 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, mconf->mt76.band_idx = 0xff; if (is_mt7927(&dev->mt76)) { - struct ieee80211_channel *chan = NULL; + struct ieee80211_channel *chan; if (link_conf->chanreq.oper.chan) chan = link_conf->chanreq.oper.chan; - else if (mvif->phy->mt76->chandef.chan) + else chan = mvif->phy->mt76->chandef.chan; mconf->mt76.band_idx = mt7927_band_idx(chan->band);