diff options
author | Arend van Spriel <arend@broadcom.com> | 2012-11-19 06:01:05 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-11-19 08:48:19 -0500 |
commit | f0dea9c73a16caac6b46886eb08f51dd82894ca4 (patch) | |
tree | fa143c4d2ef6cbafa1475c5b22a16c67de6a9269 /net/mac80211/util.c | |
parent | f4bda337bbb6e245e2a07f344990adeb6a70ff35 (diff) |
mac80211: check add_chanctx callback before use in ieee80211_reconfig
During testing our mac80211 driver a fatal error occurred which was
signalled to mac80211. Upon performing the reconfiguration of the
device a WARN_ON was triggered. This warning checked the return value
of drv_add_chanctx(). However, this returns -EOPNOTSUPP when the
driver does not provide the callback. As the callback is optional
better check it is defined before calling drv_add_chanctx().
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 5bad758abfb3..7fb55bf6561e 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1417,10 +1417,12 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | /* add channel contexts */ | 1419 | /* add channel contexts */ |
1420 | mutex_lock(&local->chanctx_mtx); | 1420 | if (local->use_chanctx) { |
1421 | list_for_each_entry(ctx, &local->chanctx_list, list) | 1421 | mutex_lock(&local->chanctx_mtx); |
1422 | WARN_ON(drv_add_chanctx(local, ctx)); | 1422 | list_for_each_entry(ctx, &local->chanctx_list, list) |
1423 | mutex_unlock(&local->chanctx_mtx); | 1423 | WARN_ON(drv_add_chanctx(local, ctx)); |
1424 | mutex_unlock(&local->chanctx_mtx); | ||
1425 | } | ||
1424 | 1426 | ||
1425 | list_for_each_entry(sdata, &local->interfaces, list) { | 1427 | list_for_each_entry(sdata, &local->interfaces, list) { |
1426 | struct ieee80211_chanctx_conf *ctx_conf; | 1428 | struct ieee80211_chanctx_conf *ctx_conf; |