7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yi Cong [ Upstream commit d0115096429ca090a592770c7645f9553a839954 ] Returning a negative errno as u8 turned -ENOENT into 0xfe, wrongly enabling CNM and NAN caps. Return int and default to no caps on error. Fixes: e8a264ccd2de ("wifi: mt76: mt7921: move init shared code in mt792x-lib module") Cc: stable@vger.kernel.org Signed-off-by: Yi Cong Link: https://patch.msgid.link/20260824021429.43761-1-cong.yi@linux.dev Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt792x_core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index f56f03bfe3874..3ce6c6ceac81c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -858,7 +858,7 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw) } EXPORT_SYMBOL_GPL(mt792x_init_wiphy); -static u8 +static int mt792x_get_offload_capability(struct device *dev, const char *fw_wm) { const struct mt76_connac2_fw_trailer *hdr; @@ -927,13 +927,20 @@ mt792x_get_mac80211_ops(struct device *dev, void *drv_data, u8 *fw_features) { struct ieee80211_ops *ops; + int ret; ops = devm_kmemdup(dev, mac80211_ops, sizeof(struct ieee80211_ops), GFP_KERNEL); if (!ops) return NULL; - *fw_features = mt792x_get_offload_capability(dev, drv_data); + ret = mt792x_get_offload_capability(dev, drv_data); + if (ret < 0) { + dev_warn(dev, "failed to read firmware offload caps: %d\n", ret); + *fw_features = 0; + } else { + *fw_features = ret; + } if (mt792x_needs_cnm_runtime(drv_data)) *fw_features |= MT792x_FW_CAP_CNM; -- 2.53.0