wcnss: Prevent access to WCNSS driver after a failure

Once the WCNSS driver trigger fails, the WCNSS platform driver main
environment is set to NULL. Any further access to WCNSS platform driver
should be prevented after this.

Change-Id: I6d391a347a144c31b70db0fd74904e5d1e020692
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
diff --git a/drivers/net/wireless/wcnss/wcnss_wlan.c b/drivers/net/wireless/wcnss/wcnss_wlan.c
index a75687b..80bb1a2 100644
--- a/drivers/net/wireless/wcnss/wcnss_wlan.c
+++ b/drivers/net/wireless/wcnss/wcnss_wlan.c
@@ -1662,6 +1662,9 @@
 {
 	struct platform_device *pdev;
 
+	if (!penv)
+		return -EFAULT;
+
 	/* first open is only to trigger WCNSS platform driver */
 	if (!penv->triggered) {
 		pr_info(DEVICE " triggered by userspace\n");
@@ -1689,7 +1692,7 @@
 {
 	int rc = 0;
 
-	if (!penv->device_opened)
+	if (!penv || !penv->device_opened)
 		return -EFAULT;
 
 	rc = wait_event_interruptible(penv->read_wait, penv->fw_cal_rcvd
@@ -1728,7 +1731,7 @@
 	int rc = 0;
 	int size = 0;
 
-	if (!penv->device_opened || penv->user_cal_available)
+	if (!penv || !penv->device_opened || penv->user_cal_available)
 		return -EFAULT;
 
 	if (penv->user_cal_rcvd == 0 && count >= 4