Commit e269d860 authored by Johannes Berg's avatar Johannes Berg

mac80211: check channel context methods

Verify that the channel context methods are
all assigned by the driver or not used.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e89a96f5
...@@ -549,6 +549,13 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, ...@@ -549,6 +549,13 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove)))
return NULL; return NULL;
/* check all or no channel context operations exist */
i = !!ops->add_chanctx + !!ops->remove_chanctx +
!!ops->change_chanctx + !!ops->assign_vif_chanctx +
!!ops->unassign_vif_chanctx;
if (WARN_ON(i != 0 && i != 5))
return NULL;
/* Ensure 32-byte alignment of our private data and hw private data. /* Ensure 32-byte alignment of our private data and hw private data.
* We use the wiphy priv data for both our ieee80211_local and for * We use the wiphy priv data for both our ieee80211_local and for
* the driver's private data * the driver's private data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment