Return-path: Received: from wolverine02.qualcomm.com ([199.106.114.251]:12431 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754136Ab2CLCVn (ORCPT ); Sun, 11 Mar 2012 22:21:43 -0400 From: Sujith Manoharan MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Message-ID: <20317.23955.98335.809864@gargle.gargle.HOWL> (sfid-20120312_032147_387072_9CF7F3EA) Date: Mon, 12 Mar 2012 07:51:07 +0530 To: CC: , Subject: [PATCH] ath9k: Fix BTCOEX shutdown Sender: linux-wireless-owner@vger.kernel.org List-ID: Flush MCI profiles only if MCI is being actually used. This fixes a panic on driver unload when non-MCI devices are being used and btcoex_enable is set. BUG: unable to handle kernel NULL pointer dereference at (null) IP: [] ath_mci_flush_profile+0x12/0x100 [ath9k] Call Trace: [] ath9k_stop_btcoex+0x5e/0x80 [ath9k] [] ath9k_stop+0xb7/0x230 [ath9k] [] ieee80211_stop_device+0x50/0x180 [mac80211] [] ieee80211_do_stop+0x2af/0x6a0 [mac80211] [] ieee80211_stop+0x1a/0x20 [mac80211] [] __dev_close_many+0x86/0xe0 [] dev_close_many+0xa0/0x110 [] rollback_registered_many+0xe8/0x260 [] unregister_netdevice_many+0x1b/0x80 [] ieee80211_remove_interfaces+0xd0/0x110 [mac80211] [] ieee80211_unregister_hw+0x53/0x120 [mac80211] [] ath9k_deinit_device+0x44/0x70 [ath9k] [] ath_pci_remove+0x54/0xa0 [ath9k] [] pci_device_remove+0x46/0x110 [] __device_release_driver+0x7c/0xe0 [] driver_detach+0xd0/0xe0 [] bus_remove_driver+0x88/0xe0 [] driver_unregister+0x62/0xa0 [] pci_unregister_driver+0x44/0xc0 [] ath_pci_exit+0x15/0x20 [ath9k] [] ath9k_exit+0x15/0x31 [ath9k] [] sys_delete_module+0x18c/0x270 [] ? retint_swapgs+0x13/0x1b [] ? trace_hardirqs_on_thunk+0x3a/0x3f [] system_call_fastpath+0x16/0x1b Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath9k/gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c index 63e4c4b1..fbe23de 100644 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c @@ -362,7 +362,8 @@ void ath9k_stop_btcoex(struct ath_softc *sc) ath9k_hw_btcoex_disable(ah); if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) ath9k_btcoex_timer_pause(sc); - ath_mci_flush_profile(&sc->btcoex.mci); + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_MCI) + ath_mci_flush_profile(&sc->btcoex.mci); } } -- 1.7.9.3