P2P: Fix the calculation of group common freqs
Previously, the calculation allowed for the same frequency to appear several times in the result. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
22264b3c61
commit
c6d7965d25
1 changed files with 10 additions and 0 deletions
|
@ -459,12 +459,22 @@ int p2p_channels_to_freqs(const struct p2p_channels *channels, int *freq_list,
|
||||||
break;
|
break;
|
||||||
for (j = 0; j < c->channels; j++) {
|
for (j = 0; j < c->channels; j++) {
|
||||||
int freq;
|
int freq;
|
||||||
|
unsigned int k;
|
||||||
|
|
||||||
if (idx + 1 == max_len)
|
if (idx + 1 == max_len)
|
||||||
break;
|
break;
|
||||||
freq = p2p_channel_to_freq(c->reg_class,
|
freq = p2p_channel_to_freq(c->reg_class,
|
||||||
c->channel[j]);
|
c->channel[j]);
|
||||||
if (freq < 0)
|
if (freq < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
for (k = 0; k < idx; k++) {
|
||||||
|
if (freq_list[k] == freq)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k < idx)
|
||||||
|
continue;
|
||||||
freq_list[idx++] = freq;
|
freq_list[idx++] = freq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue