diff options
| author | Arif Hussain <arifhussain@codeaurora.org> | 2017-02-28 15:50:32 -0800 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2017-02-28 20:31:23 -0800 |
| commit | 86d0f111bd0709437eb3f568c8348232d4e4ac00 (patch) | |
| tree | c3118eac827c30623c06db62b8c7e0f3997d871a | |
| parent | a342f2bb057071419775d250e664678ca2766522 (diff) | |
qcacld-3.0: Change dynamic memory to static from .bss segment for p_mac
Size of global context handler p_mac is too big to allocate memory
and more possibility of failing memory allocation of this big size.
So use mac global context from .bss segment by using global static
variable.
Change-Id: I3638b576b76c26181cb180d8b37e195ba3b0ecad
CRs-Fixed: 2011049
| -rw-r--r-- | core/mac/src/sys/legacy/src/system/src/mac_init_api.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c index 8c0c432dae7e..9fd4a2a6771f 100644 --- a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c +++ b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -49,6 +49,8 @@ #include "mac_trace.h" #endif +static tAniSirGlobal global_mac_context; + extern tSirRetStatus halDoCfgInit(tpAniSirGlobal pMac); extern tSirRetStatus halProcessStartEvent(tpAniSirGlobal pMac); @@ -106,25 +108,13 @@ tSirRetStatus mac_stop(tHalHandle hHal, tHalStopType stopType) tSirRetStatus mac_open(tHalHandle *pHalHandle, tHddHandle hHdd, struct cds_config_info *cds_cfg) { - tpAniSirGlobal p_mac = NULL; + tpAniSirGlobal p_mac = &global_mac_context; tSirRetStatus status = eSIR_SUCCESS; if (pHalHandle == NULL) return eSIR_FAILURE; /* - * Make sure this adapter is not already opened. (Compare pAdapter pointer in already - * allocated p_mac structures.) - * If it is opened just return pointer to previously allocated p_mac pointer. - * Or should this result in error? - */ - - /* Allocate p_mac */ - p_mac = qdf_mem_malloc(sizeof(tAniSirGlobal)); - if (NULL == p_mac) - return eSIR_MEM_ALLOC_FAILED; - - /* * Set various global fields of p_mac here * (Could be platform dependant as some variables in p_mac are platform * dependant) @@ -184,8 +174,5 @@ tSirRetStatus mac_close(tHalHandle hHal) log_deinit(pMac); - /* Finally, de-allocate the global MAC datastructure: */ - qdf_mem_free(pMac); - return eSIR_SUCCESS; } |
