Skip to content

Commit

Permalink
mac80211: convert ops checks to WARN_ON
Browse files Browse the repository at this point in the history
There's no need to BUG_ON when a driver registers
invalid operations, warn and return an error.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Aug 20, 2012
1 parent 9b86487 commit c0af073
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
int priv_size, i;
struct wiphy *wiphy;

if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config ||
!ops->add_interface || !ops->remove_interface ||
!ops->configure_filter))
return NULL;

if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove)))
return NULL;

Expand Down Expand Up @@ -597,13 +602,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,

local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);

BUG_ON(!ops->tx);
BUG_ON(!ops->start);
BUG_ON(!ops->stop);
BUG_ON(!ops->config);
BUG_ON(!ops->add_interface);
BUG_ON(!ops->remove_interface);
BUG_ON(!ops->configure_filter);
local->ops = ops;

/* set up some defaults */
Expand Down

0 comments on commit c0af073

Please sign in to comment.