linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: <linville@tuxdriver.com>
Cc: <linux-wireless@vger.kernel.org>, <ath9k-devel@lists.ath9k.org>,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: [PATCH 17/24] ath9k: use helper macro to kfree and nullify on ath9k_hw_rfdetach()
Date: Mon, 3 Aug 2009 12:24:49 -0700	[thread overview]
Message-ID: <1249327496-24629-18-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1249327496-24629-1-git-send-email-lrodriguez@atheros.com>

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/phy.c |   41 ++++++++++++---------------------
 1 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c
index 06fd057..98b1b56 100644
--- a/drivers/net/wireless/ath/ath9k/phy.c
+++ b/drivers/net/wireless/ath/ath9k/phy.c
@@ -266,32 +266,21 @@ ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,
 void
 ath9k_hw_rfdetach(struct ath_hw *ah)
 {
-	kfree(ah->analogBank0Data);
-	ah->analogBank0Data = NULL;
-
-	kfree(ah->analogBank1Data);
-	ah->analogBank1Data = NULL;
-
-	kfree(ah->analogBank2Data);
-	ah->analogBank2Data = NULL;
-
-	kfree(ah->analogBank3Data);
-	ah->analogBank3Data = NULL;
-
-	kfree(ah->analogBank6Data);
-	ah->analogBank6Data = NULL;
-
-	kfree(ah->analogBank6TPCData);
-	ah->analogBank6TPCData = NULL;
-
-	kfree(ah->analogBank7Data);
-	ah->analogBank7Data = NULL;
-
-	kfree(ah->addac5416_21);
-	ah->addac5416_21 = NULL;
-
-	kfree(ah->bank6Temp);
-	ah->bank6Temp = NULL;
+#define ATH_FREE_BANK(bank) do { \
+		kfree(bank); \
+		bank = NULL; \
+	} while (0);
+
+	ATH_FREE_BANK(ah->analogBank0Data);
+	ATH_FREE_BANK(ah->analogBank1Data);
+	ATH_FREE_BANK(ah->analogBank2Data);
+	ATH_FREE_BANK(ah->analogBank3Data);
+	ATH_FREE_BANK(ah->analogBank6Data);
+	ATH_FREE_BANK(ah->analogBank6TPCData);
+	ATH_FREE_BANK(ah->analogBank7Data);
+	ATH_FREE_BANK(ah->addac5416_21);
+	ATH_FREE_BANK(ah->bank6Temp);
+#undef ATH_FREE_BANK
 }
 
 bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
-- 
1.6.3.3


  parent reply	other threads:[~2009-08-03 19:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 01/24] ath9k: remove usage of AR_SREV_*() wrapper to detect supported hw Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 02/24] ath9k: use a switch for revising supported hw mac revisions Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 03/24] ath9k: propagate hw initialization errors Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 04/24] ath9k: move memory allocation of ath_hw to ath_init() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 05/24] ath9k: move devid cache setting " Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 06/24] ath9k: move cache setting of softc ah prior to attach Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 07/24] ath9k: call hw initializer directly Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 09/24] ath9k: move hw macrevision checker to helper Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 10/24] ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 11/24] ath9k: rename ath9k_hw_set_defaults() to ath9k_hw_init_config() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 12/24] ath9k: remove debug message for no memoery on ath_init() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 13/24] ath9k: break up hw initialization into a few more helpers Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 14/24] ath9k: describe hw initialization better Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 15/24] ath9k: distinguish between device initialization and ath_softc init Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 16/24] ath9k: remove !NULL check before kfree() Luis R. Rodriguez
2009-08-03 19:24 ` Luis R. Rodriguez [this message]
2009-08-03 19:24 ` [PATCH 18/24] ath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 19/24] ath9k: rename ath9k_hw_ani_detach() to ath9k_hw_ani_disable() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 20/24] ath9k: set ah to null after freeing Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 21/24] ath9k: set sc->sc_ah to NULL after freeing it Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 22/24] ath9k: call ath9k_hw_detach() once upon hw init failure Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 23/24] ath9k: remove dangling error check on keycache reset on hw init Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 24/24] ath9k: remove spurious check for channel on keycache reset Luis R. Rodriguez

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=1249327496-24629-18-git-send-email-lrodriguez@atheros.com \
    --to=lrodriguez@atheros.com \
    --cc=ath9k-devel@lists.ath9k.org \
    --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).