Commit 5720508d authored by Robert P. J. Day's avatar Robert P. J. Day Committed by John W. Linville
Browse files

rndis_wlan: Use kernel-supplied ARRAY_SIZE() macro.


Signed-off-by: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 90d07349
...@@ -640,8 +640,7 @@ static void dsconfig_to_freq(unsigned int dsconfig, struct iw_freq *freq) ...@@ -640,8 +640,7 @@ static void dsconfig_to_freq(unsigned int dsconfig, struct iw_freq *freq)
static int freq_to_dsconfig(struct iw_freq *freq, unsigned int *dsconfig) static int freq_to_dsconfig(struct iw_freq *freq, unsigned int *dsconfig)
{ {
if (freq->m < 1000 && freq->e == 0) { if (freq->m < 1000 && freq->e == 0) {
if (freq->m >= 1 && if (freq->m >= 1 && freq->m <= ARRAY_SIZE(freq_chan))
freq->m <= (sizeof(freq_chan) / sizeof(freq_chan[0])))
*dsconfig = freq_chan[freq->m - 1] * 1000; *dsconfig = freq_chan[freq->m - 1] * 1000;
else else
return -1; return -1;
...@@ -1179,10 +1178,9 @@ static int rndis_iw_get_range(struct net_device *dev, ...@@ -1179,10 +1178,9 @@ static int rndis_iw_get_range(struct net_device *dev,
range->throughput = 11 * 1000 * 1000 / 2; range->throughput = 11 * 1000 * 1000 / 2;
} }
range->num_channels = (sizeof(freq_chan)/sizeof(freq_chan[0])); range->num_channels = ARRAY_SIZE(freq_chan);
for (i = 0; i < (sizeof(freq_chan)/sizeof(freq_chan[0])) && for (i = 0; i < ARRAY_SIZE(freq_chan) && i < IW_MAX_FREQUENCIES; i++) {
i < IW_MAX_FREQUENCIES; i++) {
range->freq[i].i = i + 1; range->freq[i].i = i + 1;
range->freq[i].m = freq_chan[i] * 100000; range->freq[i].m = freq_chan[i] * 100000;
range->freq[i].e = 1; range->freq[i].e = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment