Commit 87f55002 authored by Johannes Berg's avatar Johannes Berg
Browse files

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: default avatarMiriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240418115219.a94852030d33.I9d647178ab25636372ed79e5312c68a06e0bf60c@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5e0c422d
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -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;

		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;