linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 3/8] mac80211: remove useless non-NULL tests from scan results code
Date: Mon, 08 Sep 2008 17:44:24 +0200	[thread overview]
Message-ID: <20080908154441.770355000@sipsolutions.net> (raw)
In-Reply-To: 20080908154421.216772000@sipsolutions.net

I'm surprised nobody complained about these before. What a waste.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/mlme.c |   40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

--- everything.orig/net/mac80211/mlme.c	2008-09-08 15:42:38.000000000 +0200
+++ everything/net/mac80211/mlme.c	2008-09-08 15:42:40.000000000 +0200
@@ -3823,6 +3823,7 @@ ieee80211_sta_scan_result(struct ieee802
 			  char *current_ev, char *end_buf)
 {
 	struct iw_event iwe;
+	char *buf;
 
 	if (time_after(jiffies,
 		       bss->last_update + IEEE80211_SCAN_RESULT_EXPIRE))
@@ -3897,7 +3898,7 @@ ieee80211_sta_scan_result(struct ieee802
 
 	ieee80211_sta_add_scan_ies(info, bss, &current_ev, end_buf);
 
-	if (bss && bss->supp_rates_len > 0) {
+	if (bss->supp_rates_len > 0) {
 		/* display all supported rates in readable format */
 		char *p = current_ev + iwe_stream_lcp_len(info);
 		int i;
@@ -3916,30 +3917,25 @@ ieee80211_sta_scan_result(struct ieee802
 		current_ev = p;
 	}
 
-	if (bss) {
-		char *buf;
-		buf = kmalloc(30, GFP_ATOMIC);
-		if (buf) {
-			memset(&iwe, 0, sizeof(iwe));
-			iwe.cmd = IWEVCUSTOM;
-			sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->timestamp));
-			iwe.u.data.length = strlen(buf);
-			current_ev = iwe_stream_add_point(info, current_ev,
-							  end_buf,
-							  &iwe, buf);
-			memset(&iwe, 0, sizeof(iwe));
-			iwe.cmd = IWEVCUSTOM;
-			sprintf(buf, " Last beacon: %dms ago",
-				jiffies_to_msecs(jiffies - bss->last_update));
-			iwe.u.data.length = strlen(buf);
-			current_ev = iwe_stream_add_point(info, current_ev,
-							  end_buf, &iwe, buf);
-			kfree(buf);
-		}
+	buf = kmalloc(30, GFP_ATOMIC);
+	if (buf) {
+		memset(&iwe, 0, sizeof(iwe));
+		iwe.cmd = IWEVCUSTOM;
+		sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->timestamp));
+		iwe.u.data.length = strlen(buf);
+		current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+						  &iwe, buf);
+		memset(&iwe, 0, sizeof(iwe));
+		iwe.cmd = IWEVCUSTOM;
+		sprintf(buf, " Last beacon: %dms ago",
+			jiffies_to_msecs(jiffies - bss->last_update));
+		iwe.u.data.length = strlen(buf);
+		current_ev = iwe_stream_add_point(info, current_ev,
+						  end_buf, &iwe, buf);
+		kfree(buf);
 	}
 
 	if (bss_mesh_cfg(bss)) {
-		char *buf;
 		u8 *cfg = bss_mesh_cfg(bss);
 		buf = kmalloc(50, GFP_ATOMIC);
 		if (buf) {

-- 


  parent reply	other threads:[~2008-09-08 15:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-08 15:44 [PATCH 0/8] mac80211 mlme cleanups Johannes Berg
2008-09-08 15:44 ` [PATCH 1/8] mac80211: reorder mlme code Johannes Berg
2008-09-08 15:44 ` [PATCH 2/8] mac80211: use sdata pointer for scan interface Johannes Berg
2008-09-08 15:44 ` Johannes Berg [this message]
2008-09-08 15:44 ` [PATCH 4/8] mac80211: start moving scan code from mlme Johannes Berg
2008-09-08 15:44 ` [PATCH 5/8] mac80211: refactor and move scan RX code Johannes Berg
2008-09-08 15:44 ` [PATCH 6/8] mac80211: move BSS handling to scan code Johannes Berg
2008-09-08 15:44 ` [PATCH 7/8] mac80211: move some HT code out of mlme.c Johannes Berg
2008-09-08 15:44 ` [PATCH 8/8] mac80211: move some HT code out of main.c Johannes Berg
2008-09-08 15:47 ` [PATCH 9/8] mac80211: clarify scan request Johannes Berg
2008-09-08 15:58 ` [PATCH 10/8] mac80211: simplify scan start Johannes Berg
2008-09-09  7:32 ` [PATCH 11/8] mac80211: remove useless 'ibss' parameter Johannes Berg
2008-09-09  8:57 ` [PATCH 12/8] mac80211: reorder frame code in mlme Johannes Berg
2008-09-09  8:58 ` [PATCH 13/8] mac80211: consolidate deauth/disassoc Johannes Berg
2008-09-09  9:43   ` Tomas Winkler
2008-09-09 10:54 ` [PATCH 14/8] mac80211: split ieee80211_sta_def_wmm_params Johannes Berg

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=20080908154441.770355000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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;
as well as URLs for NNTP newsgroup(s).