From e42477a8ea94e0c48d5e6987098d1f09e4ce854d Mon Sep 17 00:00:00 2001
From: Ashwin <ashwin.bhat@broadcom.com>
Date: Mon, 24 Aug 2015 13:43:30 -0700
Subject: [PATCH] net: wireless: bcmdhd: Check if FW is up during SAR setup

Added extra check to see if FW is up and running before we try to
setup SAR and if ther is no return error.

Bug: 23464710
Bug: 23481741

Change-Id: If3bab41594995baffc5749d6f431ec10bcfd8a66
Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
---
 drivers/net/wireless/bcmdhd/dhd_linux.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/bcmdhd/dhd_linux.c b/drivers/net/wireless/bcmdhd/dhd_linux.c
index 4b57190af945..9a8a9b896e18 100644
--- a/drivers/net/wireless/bcmdhd/dhd_linux.c
+++ b/drivers/net/wireless/bcmdhd/dhd_linux.c
@@ -823,8 +823,11 @@ static int dhd_sar_callback(struct notifier_block *nfb, unsigned long action, vo
 	s32 txpower;
 	int ret;
 
-	if (dhd->pub.busstate == DHD_BUS_DOWN)
-		return NOTIFY_DONE;
+	if (dhd->pub.busstate == DHD_BUS_DOWN || dhd->pub.up == 0) {
+		DHD_ERROR(("%s Not ready, Bus state %d firmware state %d\n",
+		       __FUNCTION__, dhd->pub.busstate, dhd->pub.up));
+		return NOTIFY_BAD;
+	}
 
 	if (data) {
 		/* if data != NULL then we expect that the notifier passed
-- 
GitLab