summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdhar, Mahesh Kumar <c_medhar@qti.qualcomm.com>2015-03-06 15:23:18 +0530
committerAnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com>2015-03-11 17:08:01 +0530
commitc2b3d3b8819825f9ea926296c7e11ec5fca5e3c2 (patch)
treece73d63b5149efcec809a2842968d43af05b2348
parentf6fb5a5a3a780d5eac6359496b949f1dee1d73d6 (diff)
HDD: Allocate/free dumpTableEntry memory as part of mac module open/close
Currently dumpTableEntry is allocated as part of macPreStart but freed during macStop function due to which in failure cases we are calling macstop even though macStart has not called. Changes are made to fix the above error handling scenario by allocate/free the dumpTableEntry memory as part of mac open/close functions. Change-Id: I69357719686b871222be852ab2a3765401376316 CRs-Fixed: 803710
-rw-r--r--CORE/SYS/legacy/src/system/src/macInitApi.c72
-rw-r--r--CORE/VOSS/src/vos_api.c4
2 files changed, 38 insertions, 38 deletions
diff --git a/CORE/SYS/legacy/src/system/src/macInitApi.c b/CORE/SYS/legacy/src/system/src/macInitApi.c
index 9ae0b5e877a5..983c8e08ae5e 100644
--- a/CORE/SYS/legacy/src/system/src/macInitApi.c
+++ b/CORE/SYS/legacy/src/system/src/macInitApi.c
@@ -62,41 +62,14 @@ tSirRetStatus macReset(tpAniSirGlobal pMac, tANI_U32 rc);
tSirRetStatus macPreStart(tHalHandle hHal)
{
- tSirRetStatus status = eSIR_SUCCESS;
- tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE;
tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
- tANI_U8 i;
-
- for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
- {
- pMac->dumpTableEntry[i] = vos_mem_malloc(sizeof(tDumpModuleEntry));
- if ( NULL == pMac->dumpTableEntry[i] )
- {
- memAllocFailed = eANI_BOOLEAN_TRUE;
- break;
- }
- else
- {
- vos_mem_set(pMac->dumpTableEntry[i], sizeof(tSirMbMsg), 0);
- }
- }
- if( memAllocFailed )
- {
- while(i>0)
- {
- i--;
- vos_mem_free(pMac->dumpTableEntry[i]);
- }
- sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n"));
- status = eSIR_FAILURE;
- }
#if defined(ANI_LOGDUMP)
//logDumpInit must be called before any module starts
logDumpInit(pMac);
#endif //#if defined(ANI_LOGDUMP)
- return status;
+ return eSIR_SUCCESS;
}
tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams)
@@ -151,7 +124,6 @@ tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams)
tSirRetStatus macStop(tHalHandle hHal, tHalStopType stopType)
{
- tANI_U8 i;
tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
peStop(pMac);
cfgCleanup( pMac );
@@ -162,11 +134,6 @@ tSirRetStatus macStop(tHalHandle hHal, tHalStopType stopType)
vos_mem_free(pMac->pResetMsg);
pMac->pResetMsg = NULL;
}
- /* Free the DumpTableEntry */
- for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
- {
- vos_mem_free(pMac->dumpTableEntry[i]);
- }
return eSIR_SUCCESS;
}
@@ -185,6 +152,8 @@ tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameter
{
tpAniSirGlobal p_mac = NULL;
tSirRetStatus status = eSIR_SUCCESS;
+ uint8_t i =0;
+ bool mem_alloc_failed = false;
if(pHalHandle == NULL)
return eSIR_FAILURE;
@@ -242,6 +211,34 @@ tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameter
if (eSIR_SUCCESS != status) {
vos_mem_free(p_mac);
sysLog(p_mac, LOGE, FL("macOpen failure\n"));
+ return status;
+ }
+
+ for (i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
+ {
+ p_mac->dumpTableEntry[i] = vos_mem_malloc(sizeof(tDumpModuleEntry));
+ if (NULL == p_mac->dumpTableEntry[i])
+ {
+ mem_alloc_failed = eANI_BOOLEAN_TRUE;
+ break;
+ }
+ else
+ {
+ vos_mem_set(p_mac->dumpTableEntry[i], sizeof(tSirMbMsg), 0);
+ }
+ }
+
+ if (mem_alloc_failed)
+ {
+ while (i>0)
+ {
+ i--;
+ vos_mem_free(p_mac->dumpTableEntry[i]);
+ }
+
+ peClose(p_mac);
+ vos_mem_free(p_mac);
+ return eSIR_FAILURE;
}
return status;
@@ -259,6 +256,7 @@ tSirRetStatus macClose(tHalHandle hHal)
{
tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
+ uint8_t i =0;
peClose(pMac);
pMac->psOffloadEnabled = FALSE;
@@ -268,6 +266,12 @@ tSirRetStatus macClose(tHalHandle hHal)
logDeinit(pMac);
+ /* Free the DumpTableEntry */
+ for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
+ {
+ vos_mem_free(pMac->dumpTableEntry[i]);
+ }
+
// Finally, de-allocate the global MAC datastructure:
vos_mem_free( pMac );
diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c
index 291a5ff5b4d7..62cfc61cbd22 100644
--- a/CORE/VOSS/src/vos_api.c
+++ b/CORE/VOSS/src/vos_api.c
@@ -680,7 +680,6 @@ VOS_STATUS vos_preStart( v_CONTEXT_t vosContext )
{
VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
"Failed to WDA prestart");
- macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
ccmStop(gpVosContext->pMACContext);
VOS_ASSERT(0);
return VOS_STATUS_E_FAILURE;
@@ -705,7 +704,6 @@ VOS_STATUS vos_preStart( v_CONTEXT_t vosContext )
"%s: Test MC thread by posting a probe message to SYS", __func__);
wlan_sys_probe();
- macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
ccmStop(gpVosContext->pMACContext);
VOS_ASSERT( 0 );
return VOS_STATUS_E_FAILURE;
@@ -716,7 +714,6 @@ VOS_STATUS vos_preStart( v_CONTEXT_t vosContext )
{
VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
"Failed to Start HTC");
- macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
ccmStop(gpVosContext->pMACContext);
VOS_ASSERT( 0 );
return VOS_STATUS_E_FAILURE;
@@ -727,7 +724,6 @@ VOS_STATUS vos_preStart( v_CONTEXT_t vosContext )
VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
"Failed to get ready event from target firmware");
HTCSetTargetToSleep(scn);
- macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
ccmStop(gpVosContext->pMACContext);
HTCStop(gpVosContext->htc_ctx);
VOS_ASSERT( 0 );