mirror of
https://github.com/adulau/aha.git
synced 2025-01-01 13:46:24 +00:00
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>
This commit is contained in:
parent
086ed117c9
commit
a2e2322d83
1 changed files with 41 additions and 38 deletions
|
@ -380,50 +380,53 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
|
|||
}
|
||||
|
||||
supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
|
||||
channels = supp_band->channels;
|
||||
if (supp_band) {
|
||||
channels = supp_band->channels;
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"Displaying %d channels in 2.4GHz band 802.11bg):\n",
|
||||
supp_band->n_channels);
|
||||
|
||||
for (i = 0; i < supp_band->n_channels; i++)
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"%d: %ddBm: BSS%s%s, %s.\n",
|
||||
ieee80211_frequency_to_channel(
|
||||
channels[i].center_freq),
|
||||
channels[i].max_power,
|
||||
channels[i].flags & IEEE80211_CHAN_RADAR ?
|
||||
" (IEEE 802.11h required)" : "",
|
||||
((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
|
||||
|| (channels[i].flags &
|
||||
IEEE80211_CHAN_RADAR)) ? "" :
|
||||
", IBSS",
|
||||
channels[i].flags &
|
||||
IEEE80211_CHAN_PASSIVE_SCAN ?
|
||||
"passive only" : "active/passive");
|
||||
"Displaying %d channels in 2.4GHz band 802.11bg):\n",
|
||||
supp_band->n_channels);
|
||||
|
||||
for (i = 0; i < supp_band->n_channels; i++)
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"%d: %ddBm: BSS%s%s, %s.\n",
|
||||
ieee80211_frequency_to_channel(
|
||||
channels[i].center_freq),
|
||||
channels[i].max_power,
|
||||
channels[i].flags & IEEE80211_CHAN_RADAR ?
|
||||
" (IEEE 802.11h required)" : "",
|
||||
((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
|
||||
|| (channels[i].flags &
|
||||
IEEE80211_CHAN_RADAR)) ? "" :
|
||||
", IBSS",
|
||||
channels[i].flags &
|
||||
IEEE80211_CHAN_PASSIVE_SCAN ?
|
||||
"passive only" : "active/passive");
|
||||
}
|
||||
supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
|
||||
channels = supp_band->channels;
|
||||
if (supp_band) {
|
||||
channels = supp_band->channels;
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"Displaying %d channels in 5.2GHz band (802.11a)\n",
|
||||
supp_band->n_channels);
|
||||
|
||||
for (i = 0; i < supp_band->n_channels; i++)
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"%d: %ddBm: BSS%s%s, %s.\n",
|
||||
ieee80211_frequency_to_channel(
|
||||
channels[i].center_freq),
|
||||
channels[i].max_power,
|
||||
channels[i].flags & IEEE80211_CHAN_RADAR ?
|
||||
" (IEEE 802.11h required)" : "",
|
||||
((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
|
||||
|| (channels[i].flags &
|
||||
IEEE80211_CHAN_RADAR)) ? "" :
|
||||
", IBSS",
|
||||
channels[i].flags &
|
||||
IEEE80211_CHAN_PASSIVE_SCAN ?
|
||||
"passive only" : "active/passive");
|
||||
"Displaying %d channels in 5.2GHz band (802.11a)\n",
|
||||
supp_band->n_channels);
|
||||
|
||||
for (i = 0; i < supp_band->n_channels; i++)
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"%d: %ddBm: BSS%s%s, %s.\n",
|
||||
ieee80211_frequency_to_channel(
|
||||
channels[i].center_freq),
|
||||
channels[i].max_power,
|
||||
channels[i].flags & IEEE80211_CHAN_RADAR ?
|
||||
" (IEEE 802.11h required)" : "",
|
||||
((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
|
||||
|| (channels[i].flags &
|
||||
IEEE80211_CHAN_RADAR)) ? "" :
|
||||
", IBSS",
|
||||
channels[i].flags &
|
||||
IEEE80211_CHAN_PASSIVE_SCAN ?
|
||||
"passive only" : "active/passive");
|
||||
}
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
kfree(buf);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue