From 5098ea28917b237691a174020836c5910c1be625 Mon Sep 17 00:00:00 2001 From: StanleyYP Wang Date: Mon, 7 Aug 2023 19:00:53 +0800 Subject: [PATCH] mac80211: mtk: avoid calling switch_vif_chanctx when use_chanctx is false Signed-off-by: StanleyYP Wang --- net/mac80211/chan.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 63e15f5..0e4ea5d 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -1160,13 +1160,15 @@ ieee80211_vif_use_reserved_reassign(struct ieee80211_sub_if_data *sdata) list_del(&sdata->reserved_chanctx_list); sdata->reserved_chanctx = NULL; - err = drv_switch_vif_chanctx(local, vif_chsw, 1, - CHANCTX_SWMODE_REASSIGN_VIF); - if (err) { - if (ieee80211_chanctx_refcount(local, new_ctx) == 0) - ieee80211_free_chanctx(local, new_ctx); + if (local->use_chanctx) { + err = drv_switch_vif_chanctx(local, vif_chsw, 1, + CHANCTX_SWMODE_REASSIGN_VIF); + if (err) { + if (ieee80211_chanctx_refcount(local, new_ctx) == 0) + ieee80211_free_chanctx(local, new_ctx); - goto out; + goto out; + } } list_move(&sdata->assigned_chanctx_list, &new_ctx->assigned_vifs); -- 2.18.0