wlan: Use static memory for part of pal device context, gpEnv

Use static memory for part of pal device context, gpEnv
Will fix potential memory corruption

Change-Id: I0512c4a2b375905c348e9333feffced4e89ce1ba
CR-Fixed: 421675
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_device.c b/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
index 5b97b4f..eb0f43a 100644
--- a/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
@@ -105,7 +105,7 @@
  * Static Variable Definitions
  * -------------------------------------------------------------------------*/
 
-static struct wcnss_env {
+typedef struct {
    struct resource *wcnss_memory;
    void __iomem    *mmio;
    int              tx_irq;
@@ -116,7 +116,10 @@
    void            *rx_context;
    int              rx_registered;
    int              tx_registered;
-} *gpEnv = NULL;
+} wcnss_env;
+
+static wcnss_env  gEnv;
+static wcnss_env *gpEnv = NULL;
 
 /*----------------------------------------------------------------------------
  * Static Function Declarations and Definitions
@@ -671,7 +674,7 @@
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
-   gpEnv = wpalMemoryAllocate(sizeof(*gpEnv));
+   gpEnv = &gEnv;
    if (NULL == gpEnv) {
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: memory allocation failure",
@@ -705,7 +708,6 @@
    return eWLAN_PAL_STATUS_SUCCESS;
 
  err_ioremap:
-   wpalMemoryFree(gpEnv);
    gpEnv = NULL;
 
    return eWLAN_PAL_STATUS_E_FAILURE;
@@ -744,7 +746,6 @@
       free_irq(gpEnv->tx_irq, gpEnv);
    }
    iounmap(gpEnv->mmio);
-   wpalMemoryFree(gpEnv);
    gpEnv = NULL;
 
    return eWLAN_PAL_STATUS_SUCCESS;