summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-power.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-04-18 18:12:37 +0200
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-04-18 18:14:30 +0200
commit3e41ace5deef7af16dd277d9d17f9d36dca0a10e (patch)
tree213bf23ffeaede74cddd033ccd45a1d45e9d3f3b /drivers/net/wireless/iwlwifi/iwl-power.c
parentiwlagn: use direct call for led functions (diff)
downloadlinux-3e41ace5deef7af16dd277d9d17f9d36dca0a10e.tar.xz
linux-3e41ace5deef7af16dd277d9d17f9d36dca0a10e.zip
iwlagn: remove most BUG_ON instances
There are a number of things in the driver that may result in a BUG(), which is suboptimal since it's hard to get debugging information out of the driver in that case and the user experience is also not good :-) Almost all BUG_ON instances can be converted to WARN_ON with a few lines of appropriate error handling, so do that instead. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-power.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index ae176d8da9e8..b7cd95820ff8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -188,9 +188,10 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv,
table = range_0;
}
- BUG_ON(lvl < 0 || lvl >= IWL_POWER_NUM);
-
- *cmd = table[lvl].cmd;
+ if (WARN_ON(lvl < 0 || lvl >= IWL_POWER_NUM))
+ memset(cmd, 0, sizeof(*cmd));
+ else
+ *cmd = table[lvl].cmd;
if (period == 0) {
skip = 0;