Message ID | 1394401348.6972.50.camel@joe-AO722 (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Joe Perches <joe@perches.com> writes: > On Sun, 2014-03-09 at 08:57 +0200, Kalle Valo wrote: >> Fixes checkpatch warning: > > Maybe better to check the bss value and return > early to save an indent level like: Yeah, this is better. I'll send a patch to do that.
That inverts the meaning of the condition though. On 03/09/2014 10:42 PM, Joe Perches wrote: ... > - if (bss == NULL) { ... > - } else > + if (!bss) { if (bss) { > ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "cfg80211 already has a bss\n"); > + return NULL; > + } ... -- 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
Jones Desougi <jones.desougi@27m.se> writes: > That inverts the meaning of the condition though. > > > On 03/09/2014 10:42 PM, Joe Perches wrote: > ... >> - if (bss == NULL) { > ... >> - } else >> + if (!bss) { > > if (bss) { Yeah, that was buggy. Thanks for pointing it out.
On Wed, 2014-03-12 at 10:52 +0200, Kalle Valo wrote: > Jones Desougi <jones.desougi@27m.se> writes: > > That inverts the meaning of the condition though. > > On 03/09/2014 10:42 PM, Joe Perches wrote: > > ... > >> - if (bss == NULL) { > > ... > >> - } else > >> + if (!bss) { > > if (bss) { > Yeah, that was buggy. Thanks for pointing it out. Yes, I stuffed that one up. And Jones, thanks for noticing. -- 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 --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index c2c6f46..4c136e0 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -700,32 +700,33 @@ ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, bss = cfg80211_get_bss(ar->wiphy, chan, bssid, vif->ssid, vif->ssid_len, cap_mask, cap_val); - if (bss == NULL) { - /* - * Since cfg80211 may not yet know about the BSS, - * generate a partial entry until the first BSS info - * event becomes available. - * - * Prepend SSID element since it is not included in the Beacon - * IEs from the target. - */ - ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL); - if (ie == NULL) - return NULL; - ie[0] = WLAN_EID_SSID; - ie[1] = vif->ssid_len; - memcpy(ie + 2, vif->ssid, vif->ssid_len); - memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len); - bss = cfg80211_inform_bss(ar->wiphy, chan, - bssid, 0, cap_val, 100, - ie, 2 + vif->ssid_len + beacon_ie_len, - 0, GFP_KERNEL); - if (bss) - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "added bss %pM to cfg80211\n", bssid); - kfree(ie); - } else + if (!bss) { ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "cfg80211 already has a bss\n"); + return NULL; + } + + /* Since cfg80211 may not yet know about the BSS, generate a + * partial entry until the first BSS info event becomes available. + * + * Prepend SSID element since it is not included in the Beacon + * IEs from the target. + */ + ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL); + if (!ie) + return NULL; + + ie[0] = WLAN_EID_SSID; + ie[1] = vif->ssid_len; + memcpy(ie + 2, vif->ssid, vif->ssid_len); + memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len); + bss = cfg80211_inform_bss(ar->wiphy, chan, bssid, 0, cap_val, 100, + ie, 2 + vif->ssid_len + beacon_ie_len, + 0, GFP_KERNEL); + if (bss) + ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "added bss %pM to cfg80211\n", + bssid); + + kfree(ie); return bss; }
On Sun, 2014-03-09 at 08:57 +0200, Kalle Valo wrote: > Fixes checkpatch warning: Maybe better to check the bss value and return early to save an indent level like: --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 51 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 25 deletions(-) -- 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