diff mbox

brcmsmac: fix brcms_c_regd_init() which crashed after 11ad patch

Message ID 1341321280-6136-1-git-send-email-arend@broadcom.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Arend van Spriel July 3, 2012, 1:14 p.m. UTC
This patch fixes an OOPS in brcmsmac driver, which was introduced
by the 11ad patch 'cfg80211: add 802.11ad (60gHz band) support'.
The value IEEE80211_NUM_BANDS increased, which was used in the
brcms_c_regd_init() function.

Cc: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/net/wireless/brcm80211/brcmsmac/channel.c |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Comments

Seth Forshee July 3, 2012, 1:26 p.m. UTC | #1
On Tue, Jul 03, 2012 at 03:14:40PM +0200, Arend van Spriel wrote:
> This patch fixes an OOPS in brcmsmac driver, which was introduced
> by the 11ad patch 'cfg80211: add 802.11ad (60gHz band) support'.
> The value IEEE80211_NUM_BANDS increased, which was used in the
> brcms_c_regd_init() function.
> 
> Cc: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
> Cc: Johannes Berg <johannes.berg@intel.com>
> Cc: Seth Forshee <seth.forshee@canonical.com>
> Signed-off-by: Arend van Spriel <arend@broadcom.com>

Acked-by: Seth Forshee <seth.forshee@canonical.com>

Just one minor nit ...

> +		if (band_idx == BAND_2G_INDEX) {
> +			sband = wiphy->bands[IEEE80211_BAND_2GHZ];
> +		} else {
> +			sband = wiphy->bands[IEEE80211_BAND_5GHZ];
> +		}

No need for braces here.

Cheers,
Seth

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel July 3, 2012, 4:33 p.m. UTC | #2
On 07/03/2012 03:26 PM, Seth Forshee wrote:
> On Tue, Jul 03, 2012 at 03:14:40PM +0200, Arend van Spriel wrote:
>> This patch fixes an OOPS in brcmsmac driver, which was introduced
>> by the 11ad patch 'cfg80211: add 802.11ad (60gHz band) support'.
>> The value IEEE80211_NUM_BANDS increased, which was used in the
>> brcms_c_regd_init() function.
>>
>> Cc: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
>> Cc: Johannes Berg <johannes.berg@intel.com>
>> Cc: Seth Forshee <seth.forshee@canonical.com>
>> Signed-off-by: Arend van Spriel <arend@broadcom.com>
> 
> Acked-by: Seth Forshee <seth.forshee@canonical.com>
> 
> Just one minor nit ...
> 
>> +		if (band_idx == BAND_2G_INDEX) {
>> +			sband = wiphy->bands[IEEE80211_BAND_2GHZ];
>> +		} else {
>> +			sband = wiphy->bands[IEEE80211_BAND_5GHZ];
>> +		}
> 
> No need for braces here.

I hate nits so I will remove them.

Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
index 2d365d3..2643669 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
@@ -763,20 +763,17 @@  void brcms_c_regd_init(struct brcms_c_info *wlc)
 	int band_idx, i;
 
 	/* Disable any channels not supported by the phy */
-	for (band_idx = 0; band_idx < IEEE80211_NUM_BANDS; band_idx++) {
-		if (band_idx == IEEE80211_BAND_2GHZ)
-			band = wlc->bandstate[BAND_2G_INDEX];
-		else
-			band = wlc->bandstate[BAND_5G_INDEX];
-
-		/* skip if band not initialized */
-		if (band->pi == NULL)
-			continue;
+	for (band_idx = 0; band_idx < wlc->pub->_nbands; band_idx++) {
+		band = wlc->bandstate[band_idx];
 
 		wlc_phy_chanspec_band_validch(band->pi, band->bandtype,
 					      &sup_chan);
 
-		sband = wiphy->bands[band_idx];
+		if (band_idx == BAND_2G_INDEX) {
+			sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+		} else {
+			sband = wiphy->bands[IEEE80211_BAND_5GHZ];
+		}
 		for (i = 0; i < sband->n_channels; i++) {
 			ch = &sband->channels[i];
 			if (!isset(sup_chan.vec, ch->hw_value))