Rafał Miłecki <zajec5@xxxxxxxxx> writes: >>> @@ -5873,33 +5872,33 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, >>> ch.bw == BRCMU_CHAN_BW_80) >>> continue; >>> >>> - channel = band->channels; >>> - index = band->n_channels; >>> + channel = NULL; >>> for (j = 0; j < band->n_channels; j++) { >>> - if (channel[j].hw_value == ch.control_ch_num) { >>> - index = j; >>> + if (band->channels[j].hw_value == ch.control_ch_num) { >>> + channel = &band->channels[j]; >>> break; >>> } >>> } >> >> You could have kept the index construct and simply check if j == >> band->n_channels here to determine something is wrong. > > I wanted to simplify code at the same time. Having channel[index] > repeated 7 times was a hint for me it could be handled better. I > should have made that clear, I'll fix improve this in V2. If you are making a patch to stable or -rc releases you should keep the patch as simple as possible and do all the cleanup later. But I see that you dropped "cc stable" in this patch so all is good, just a general remark. -- Kalle Valo