From: Joe Perches <joe@perches.com>
To: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: ath6kl@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/6] ath6kl: use braces on both arms of if statement
Date: Sun, 09 Mar 2014 14:42:28 -0700 [thread overview]
Message-ID: <1394401348.6972.50.camel@joe-AO722> (raw)
In-Reply-To: <20140309065717.10793.76274.stgit@x230>
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(-)
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;
}
next prev parent reply other threads:[~2014-03-09 21:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-09 6:57 [PATCH 0/6] ath6kl: fixing new checkpatch warnings Kalle Valo
2014-03-09 6:57 ` [PATCH 1/6] ath6kl: fix blank lines before and after braces Kalle Valo
2014-03-09 6:57 ` [PATCH 2/6] ath6kl: use braces on both arms of if statement Kalle Valo
2014-03-09 21:42 ` Joe Perches [this message]
2014-03-10 17:23 ` Kalle Valo
2014-03-12 8:47 ` Jones Desougi
2014-03-12 8:52 ` Kalle Valo
2014-03-12 14:11 ` Joe Perches
2014-03-09 6:57 ` [PATCH 3/6] ath6kl: remove spaces before semicolon Kalle Valo
2014-03-09 6:57 ` [PATCH 4/6] ath6kl: remove unnecessary line continuations Kalle Valo
2014-03-09 21:15 ` Joe Perches
2014-03-10 17:26 ` Kalle Valo
2014-03-09 6:57 ` [PATCH 5/6] ath6kl: remove a warning on a macro Kalle Valo
2014-03-09 7:10 ` Kalle Valo
2014-03-09 7:20 ` Joe Perches
2014-03-09 7:44 ` Joe Perches
2014-03-10 17:29 ` Kalle Valo
2014-03-10 20:03 ` Joe Perches
2014-03-09 6:57 ` [PATCH 6/6] ath6kl: update Kconfig descriptions Kalle Valo
2014-03-13 5:48 ` [PATCH 0/6] ath6kl: fixing new checkpatch warnings Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394401348.6972.50.camel@joe-AO722 \
--to=joe@perches.com \
--cc=ath6kl@lists.infradead.org \
--cc=kvalo@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox