aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r--net/wireless/wext-compat.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 5ef82f2ca88f..abf6b0a047d8 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -296,22 +296,34 @@ EXPORT_SYMBOL_GPL(cfg80211_wext_siwmlme);
296struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, 296struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
297 struct iw_freq *freq) 297 struct iw_freq *freq)
298{ 298{
299 struct ieee80211_channel *chan;
300 int f;
301
302 /*
303 * Parse frequency - return NULL for auto and
304 * -EINVAL for impossible things.
305 */
299 if (freq->e == 0) { 306 if (freq->e == 0) {
300 if (freq->m < 0) 307 if (freq->m < 0)
301 return NULL; 308 return NULL;
302 else 309 f = ieee80211_channel_to_frequency(freq->m);
303 return ieee80211_get_channel(wiphy,
304 ieee80211_channel_to_frequency(freq->m));
305 } else { 310 } else {
306 int i, div = 1000000; 311 int i, div = 1000000;
307 for (i = 0; i < freq->e; i++) 312 for (i = 0; i < freq->e; i++)
308 div /= 10; 313 div /= 10;
309 if (div > 0) 314 if (div <= 0)
310 return ieee80211_get_channel(wiphy, freq->m / div);
311 else
312 return ERR_PTR(-EINVAL); 315 return ERR_PTR(-EINVAL);
316 f = freq->m / div;
313 } 317 }
314 318
319 /*
320 * Look up channel struct and return -EINVAL when
321 * it cannot be found.
322 */
323 chan = ieee80211_get_channel(wiphy, f);
324 if (!chan)
325 return ERR_PTR(-EINVAL);
326 return chan;
315} 327}
316EXPORT_SYMBOL_GPL(cfg80211_wext_freq); 328EXPORT_SYMBOL_GPL(cfg80211_wext_freq);
317 329