diff options
author | Tim Gardner <tim.gardner@canonical.com> | 2012-12-07 08:28:34 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-12-10 16:38:58 -0500 |
commit | 8907a6fb6281a9aa25df2c7e2996cedcd6e5559f (patch) | |
tree | 9750b7669af88d82789ae0d11a31f95f327a5124 /drivers | |
parent | c8a8ab4472619e6936a224c5a950750d640aefbb (diff) |
iwlwifi: iwlagn_request_scan: Fix check for priv->scan_request
The WARN_ON_ONCE() check for scan_request will not correctly detect
a NULL pointer for scan_type == IWL_SCAN_NORMAL. Make it explicit
that the check only applies to normal scans.
Convert WARN_ON_ONCE to WARN_ON since priv->scan_request really _can't_
be NULL for normal scans. If it is then we should emit frequent warnings.
This smatch warning led to scrutiny of iwlagn_request_scan():
drivers/net/wireless/iwlwifi/dvm/scan.c:894 iwlagn_request_scan() error: we previously assumed 'priv->scan_request' could be null (see line 792)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/dvm/scan.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c index aad5fa424a58..610ed2204e1f 100644 --- a/drivers/net/wireless/iwlwifi/dvm/scan.c +++ b/drivers/net/wireless/iwlwifi/dvm/scan.c | |||
@@ -673,8 +673,9 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
673 | const u8 *ssid = NULL; | 673 | const u8 *ssid = NULL; |
674 | u8 ssid_len = 0; | 674 | u8 ssid_len = 0; |
675 | 675 | ||
676 | if (WARN_ON_ONCE(priv->scan_request && | 676 | if (WARN_ON(priv->scan_type == IWL_SCAN_NORMAL && |
677 | priv->scan_request->n_channels > MAX_SCAN_CHANNEL)) | 677 | (!priv->scan_request || |
678 | priv->scan_request->n_channels > MAX_SCAN_CHANNEL))) | ||
678 | return -EINVAL; | 679 | return -EINVAL; |
679 | 680 | ||
680 | lockdep_assert_held(&priv->mutex); | 681 | lockdep_assert_held(&priv->mutex); |