aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-05-22 14:01:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-22 14:06:09 -0400
commita2e2322d83df82a57ba456cfa604c8b8f7b04670 (patch)
tree8cf7894be6737eb134ee578ef876b4aa2254776b /drivers/net
parent086ed117c918f07fd40323ab5adc64c52ea7c1b8 (diff)
iwlwifi: check for valid band for channel info
when display channel info in debugfs, always check for valid band before access the pointer and display information for 1000 NIC, it only support "bgn" mode, so there is no 5.2GHz channels available to display. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c79
1 files changed, 41 insertions, 38 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 03006c66a20e..af70229144b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -380,50 +380,53 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
380 } 380 }
381 381
382 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); 382 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
383 channels = supp_band->channels; 383 if (supp_band) {
384 channels = supp_band->channels;
384 385
385 pos += scnprintf(buf + pos, bufsz - pos,
386 "Displaying %d channels in 2.4GHz band 802.11bg):\n",
387 supp_band->n_channels);
388
389 for (i = 0; i < supp_band->n_channels; i++)
390 pos += scnprintf(buf + pos, bufsz - pos, 386 pos += scnprintf(buf + pos, bufsz - pos,
391 "%d: %ddBm: BSS%s%s, %s.\n", 387 "Displaying %d channels in 2.4GHz band 802.11bg):\n",
392 ieee80211_frequency_to_channel( 388 supp_band->n_channels);
393 channels[i].center_freq),
394 channels[i].max_power,
395 channels[i].flags & IEEE80211_CHAN_RADAR ?
396 " (IEEE 802.11h required)" : "",
397 ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
398 || (channels[i].flags &
399 IEEE80211_CHAN_RADAR)) ? "" :
400 ", IBSS",
401 channels[i].flags &
402 IEEE80211_CHAN_PASSIVE_SCAN ?
403 "passive only" : "active/passive");
404 389
390 for (i = 0; i < supp_band->n_channels; i++)
391 pos += scnprintf(buf + pos, bufsz - pos,
392 "%d: %ddBm: BSS%s%s, %s.\n",
393 ieee80211_frequency_to_channel(
394 channels[i].center_freq),
395 channels[i].max_power,
396 channels[i].flags & IEEE80211_CHAN_RADAR ?
397 " (IEEE 802.11h required)" : "",
398 ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
399 || (channels[i].flags &
400 IEEE80211_CHAN_RADAR)) ? "" :
401 ", IBSS",
402 channels[i].flags &
403 IEEE80211_CHAN_PASSIVE_SCAN ?
404 "passive only" : "active/passive");
405 }
405 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); 406 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
406 channels = supp_band->channels; 407 if (supp_band) {
408 channels = supp_band->channels;
407 409
408 pos += scnprintf(buf + pos, bufsz - pos,
409 "Displaying %d channels in 5.2GHz band (802.11a)\n",
410 supp_band->n_channels);
411
412 for (i = 0; i < supp_band->n_channels; i++)
413 pos += scnprintf(buf + pos, bufsz - pos, 410 pos += scnprintf(buf + pos, bufsz - pos,
414 "%d: %ddBm: BSS%s%s, %s.\n", 411 "Displaying %d channels in 5.2GHz band (802.11a)\n",
415 ieee80211_frequency_to_channel( 412 supp_band->n_channels);
416 channels[i].center_freq), 413
417 channels[i].max_power, 414 for (i = 0; i < supp_band->n_channels; i++)
418 channels[i].flags & IEEE80211_CHAN_RADAR ? 415 pos += scnprintf(buf + pos, bufsz - pos,
419 " (IEEE 802.11h required)" : "", 416 "%d: %ddBm: BSS%s%s, %s.\n",
420 ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) 417 ieee80211_frequency_to_channel(
421 || (channels[i].flags & 418 channels[i].center_freq),
422 IEEE80211_CHAN_RADAR)) ? "" : 419 channels[i].max_power,
423 ", IBSS", 420 channels[i].flags & IEEE80211_CHAN_RADAR ?
424 channels[i].flags & 421 " (IEEE 802.11h required)" : "",
425 IEEE80211_CHAN_PASSIVE_SCAN ? 422 ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
426 "passive only" : "active/passive"); 423 || (channels[i].flags &
424 IEEE80211_CHAN_RADAR)) ? "" :
425 ", IBSS",
426 channels[i].flags &
427 IEEE80211_CHAN_PASSIVE_SCAN ?
428 "passive only" : "active/passive");
429 }
427 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 430 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
428 kfree(buf); 431 kfree(buf);
429 return ret; 432 return ret;