diff options
author | Johannes Berg <johannes.berg@intel.com> | 2024-04-18 11:52:20 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2024-04-19 10:19:37 +0200 |
commit | 87f5500285fbd27eb36efbcd02ddcee1ad27ec91 (patch) | |
tree | d042d77d8700355e13a60807ff7210efc1005e15 /net/mac80211/chan.c | |
parent | wifi: mac80211: reserve chanctx during find (diff) | |
download | linux-87f5500285fbd27eb36efbcd02ddcee1ad27ec91.tar.xz linux-87f5500285fbd27eb36efbcd02ddcee1ad27ec91.zip |
wifi: mac80211: simplify ieee80211_assign_link_chanctx()
There's no need for a label/goto here, the only thing is
that drv_assign_vif_chanctx() must succeed to set 'conf'
and add the new context to the list, the remaining code
is (and must be) the same regardless.
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240418115219.a94852030d33.I9d647178ab25636372ed79e5312c68a06e0bf60c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r-- | net/mac80211/chan.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 6d0148dea126..2c338014ded5 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -815,7 +815,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, struct ieee80211_local *local = sdata->local; struct ieee80211_chanctx_conf *conf; struct ieee80211_chanctx *curr_ctx = NULL; - int ret = 0; + int ret; if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_NAN)) return -EOPNOTSUPP; @@ -836,15 +836,16 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, ieee80211_recalc_chanctx_min_def(local, new_ctx, link); ret = drv_assign_vif_chanctx(local, sdata, link->conf, new_ctx); - if (ret) - goto out; - - conf = &new_ctx->conf; - list_add(&link->assigned_chanctx_list, - &new_ctx->assigned_links); + if (!ret) { + /* succeeded, so commit it to the data structures */ + conf = &new_ctx->conf; + list_add(&link->assigned_chanctx_list, + &new_ctx->assigned_links); + } + } else { + ret = 0; } -out: rcu_assign_pointer(link->conf->chanctx_conf, conf); sdata->vif.cfg.idle = !conf; |