diff options
author | Christian Lamparter <chunkeey@googlemail.com> | 2009-10-31 17:59:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-02 15:43:23 -0500 |
commit | 93a59d7527147e3656664aa3179f8d19de256081 (patch) | |
tree | 8b16907b7f2e8901ddb5d83dbc80b8b7129aab4b /drivers/net/wireless/p54 | |
parent | 6d3560d4fc9c5b9fe1a07a63926ea70512c69c32 (diff) |
p54: disable channels with incomplete calibration data sets
James Grossmann [1] reported that p54 spews out confusing
messages instead of preventing the mayhem from happening.
the reason is that "p54: generate channel list dynamically"
is not perfect. It didn't discard incomplete channel data
sets and therefore p54 advertised to support them as well.
[1]: http://marc.info/?l=linux-wireless&m=125699830215890
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: James Grossmann <cctsurf@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r-- | drivers/net/wireless/p54/eeprom.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c index 0efe67deedee..8e3818f6832e 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c | |||
@@ -126,7 +126,7 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
126 | int ret = -ENOMEM; | 126 | int ret = -ENOMEM; |
127 | 127 | ||
128 | if ((!list->entries) || (!list->band_channel_num[band])) | 128 | if ((!list->entries) || (!list->band_channel_num[band])) |
129 | return 0; | 129 | return -EINVAL; |
130 | 130 | ||
131 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); | 131 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); |
132 | if (!tmp) | 132 | if (!tmp) |
@@ -158,6 +158,7 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
158 | (list->channels[i].data & CHAN_HAS_CURVE ? "" : | 158 | (list->channels[i].data & CHAN_HAS_CURVE ? "" : |
159 | " [curve data]"), | 159 | " [curve data]"), |
160 | list->channels[i].index, list->channels[i].freq); | 160 | list->channels[i].index, list->channels[i].freq); |
161 | continue; | ||
161 | } | 162 | } |
162 | 163 | ||
163 | tmp->channels[j].band = list->channels[i].band; | 164 | tmp->channels[j].band = list->channels[i].band; |
@@ -165,7 +166,16 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
165 | j++; | 166 | j++; |
166 | } | 167 | } |
167 | 168 | ||
168 | tmp->n_channels = list->band_channel_num[band]; | 169 | if (j == 0) { |
170 | printk(KERN_ERR "%s: Disabling totally damaged %s band.\n", | ||
171 | wiphy_name(dev->wiphy), (band == IEEE80211_BAND_2GHZ) ? | ||
172 | "2 GHz" : "5 GHz"); | ||
173 | |||
174 | ret = -ENODATA; | ||
175 | goto err_out; | ||
176 | } | ||
177 | |||
178 | tmp->n_channels = j; | ||
169 | old = priv->band_table[band]; | 179 | old = priv->band_table[band]; |
170 | priv->band_table[band] = tmp; | 180 | priv->band_table[band] = tmp; |
171 | if (old) { | 181 | if (old) { |
@@ -228,13 +238,13 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
228 | struct p54_common *priv = dev->priv; | 238 | struct p54_common *priv = dev->priv; |
229 | struct p54_channel_list *list; | 239 | struct p54_channel_list *list; |
230 | unsigned int i, j, max_channel_num; | 240 | unsigned int i, j, max_channel_num; |
231 | int ret = -ENOMEM; | 241 | int ret = 0; |
232 | u16 freq; | 242 | u16 freq; |
233 | 243 | ||
234 | if ((priv->iq_autocal_len != priv->curve_data->entries) || | 244 | if ((priv->iq_autocal_len != priv->curve_data->entries) || |
235 | (priv->iq_autocal_len != priv->output_limit->entries)) | 245 | (priv->iq_autocal_len != priv->output_limit->entries)) |
236 | printk(KERN_ERR "%s: EEPROM is damaged... you may not be able" | 246 | printk(KERN_ERR "%s: Unsupported or damaged EEPROM detected. " |
237 | "to use all channels with this device.\n", | 247 | "You may not be able to use all channels.\n", |
238 | wiphy_name(dev->wiphy)); | 248 | wiphy_name(dev->wiphy)); |
239 | 249 | ||
240 | max_channel_num = max_t(unsigned int, priv->output_limit->entries, | 250 | max_channel_num = max_t(unsigned int, priv->output_limit->entries, |
@@ -243,8 +253,10 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
243 | priv->curve_data->entries); | 253 | priv->curve_data->entries); |
244 | 254 | ||
245 | list = kzalloc(sizeof(*list), GFP_KERNEL); | 255 | list = kzalloc(sizeof(*list), GFP_KERNEL); |
246 | if (!list) | 256 | if (!list) { |
257 | ret = -ENOMEM; | ||
247 | goto free; | 258 | goto free; |
259 | } | ||
248 | 260 | ||
249 | list->max_entries = max_channel_num; | 261 | list->max_entries = max_channel_num; |
250 | list->channels = kzalloc(sizeof(struct p54_channel_entry) * | 262 | list->channels = kzalloc(sizeof(struct p54_channel_entry) * |
@@ -282,13 +294,8 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
282 | p54_compare_channels, NULL); | 294 | p54_compare_channels, NULL); |
283 | 295 | ||
284 | for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) { | 296 | for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) { |
285 | if (list->band_channel_num[i]) { | 297 | if (p54_generate_band(dev, list, i) == 0) |
286 | ret = p54_generate_band(dev, list, i); | ||
287 | if (ret) | ||
288 | goto free; | ||
289 | |||
290 | j++; | 298 | j++; |
291 | } | ||
292 | } | 299 | } |
293 | if (j == 0) { | 300 | if (j == 0) { |
294 | /* no useable band available. */ | 301 | /* no useable band available. */ |