From 6b827529058d6d479f31b281a9ec630f7b6841e1 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Mon, 3 Aug 2009 12:24:49 -0700 Subject: [PATCH] ath9k: use helper macro to kfree and nullify on ath9k_hw_rfdetach() Signed-off-by: Luis R. Rodriguez Signed-off-by: John W. Linville --- drivers/net/wireless/ath/ath9k/phy.c | 41 ++++++++++------------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c index 06fd057e467b..98b1b56d87c4 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) -- 2.39.5