diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-04-18 12:12:37 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-04-18 12:14:30 -0400 |
commit | 3e41ace5deef7af16dd277d9d17f9d36dca0a10e (patch) | |
tree | 213bf23ffeaede74cddd033ccd45a1d45e9d3f3b /drivers/net/wireless/iwlwifi/iwl-hcmd.c | |
parent | e79b1ca75bb48111e8d93fc576f50e24671f5f9d (diff) |
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-hcmd.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-hcmd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 9177b553fe57..8f0beb992ccf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -143,10 +143,12 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
143 | { | 143 | { |
144 | int ret; | 144 | int ret; |
145 | 145 | ||
146 | BUG_ON(!(cmd->flags & CMD_ASYNC)); | 146 | if (WARN_ON(!(cmd->flags & CMD_ASYNC))) |
147 | return -EINVAL; | ||
147 | 148 | ||
148 | /* An asynchronous command can not expect an SKB to be set. */ | 149 | /* An asynchronous command can not expect an SKB to be set. */ |
149 | BUG_ON(cmd->flags & CMD_WANT_SKB); | 150 | if (WARN_ON(cmd->flags & CMD_WANT_SKB)) |
151 | return -EINVAL; | ||
150 | 152 | ||
151 | /* Assign a generic callback if one is not provided */ | 153 | /* Assign a generic callback if one is not provided */ |
152 | if (!cmd->callback) | 154 | if (!cmd->callback) |
@@ -169,10 +171,12 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
169 | int cmd_idx; | 171 | int cmd_idx; |
170 | int ret; | 172 | int ret; |
171 | 173 | ||
172 | lockdep_assert_held(&priv->mutex); | 174 | if (WARN_ON(cmd->flags & CMD_ASYNC)) |
175 | return -EINVAL; | ||
173 | 176 | ||
174 | /* A synchronous command can not have a callback set. */ | 177 | /* A synchronous command can not have a callback set. */ |
175 | BUG_ON((cmd->flags & CMD_ASYNC) || cmd->callback); | 178 | if (WARN_ON(cmd->callback)) |
179 | return -EINVAL; | ||
176 | 180 | ||
177 | IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", | 181 | IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", |
178 | get_cmd_string(cmd->id)); | 182 | get_cmd_string(cmd->id)); |