qcacld: free wlan_cfg_buf after loading
Mark the buffer with __init to allow free after loading Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com> Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
committed by
UtsavBalar1231
parent
5b071a8d89
commit
4a4cf8a97e
@@ -43,6 +43,8 @@
|
||||
#include "wlan_hdd_green_ap_cfg.h"
|
||||
#include "wlan_hdd_twt.h"
|
||||
|
||||
static char *wlan_cfg_buf;
|
||||
|
||||
static void
|
||||
cb_notify_set_roam_prefer5_g_hz(struct hdd_context *hdd_ctx,
|
||||
unsigned long notify_id)
|
||||
@@ -8699,28 +8701,14 @@ static void hdd_set_rx_mode_value(struct hdd_context *hdd_ctx)
|
||||
QDF_STATUS hdd_parse_config_ini(struct hdd_context *hdd_ctx)
|
||||
{
|
||||
int i = 0;
|
||||
char *buffer, *line, *pTemp = NULL;
|
||||
size_t size;
|
||||
char *buffer = wlan_cfg_buf, *line;
|
||||
char *name, *value;
|
||||
/* cfgIniTable is static to avoid excess stack usage */
|
||||
static struct hdd_cfg_entry cfgIniTable[MAX_CFG_INI_ITEMS];
|
||||
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
|
||||
#include "wlan_cfg_ini.h"
|
||||
|
||||
memset(cfgIniTable, 0, sizeof(cfgIniTable));
|
||||
|
||||
size = strlen(wlan_cfg) + 1;
|
||||
buffer = (char *)qdf_mem_malloc(size);
|
||||
|
||||
if (NULL == buffer) {
|
||||
hdd_err("qdf_mem_malloc failure");
|
||||
qdf_status = QDF_STATUS_E_NOMEM;
|
||||
goto config_exit;
|
||||
}
|
||||
pTemp = buffer;
|
||||
|
||||
qdf_mem_copy((void *)buffer, (void *)wlan_cfg, size);
|
||||
|
||||
while (buffer != NULL) {
|
||||
line = get_next_line(buffer);
|
||||
buffer = i_trim(buffer);
|
||||
@@ -8768,8 +8756,7 @@ QDF_STATUS hdd_parse_config_ini(struct hdd_context *hdd_ctx)
|
||||
if (QDF_GLOBAL_MONITOR_MODE == cds_get_conparam())
|
||||
hdd_override_all_ps(hdd_ctx);
|
||||
|
||||
config_exit:
|
||||
qdf_mem_free(pTemp);
|
||||
qdf_mem_free(wlan_cfg_buf);
|
||||
return qdf_status;
|
||||
}
|
||||
|
||||
@@ -10780,3 +10767,16 @@ QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t nss)
|
||||
hdd_set_policy_mgr_user_cfg(hdd_ctx);
|
||||
return (status == false) ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static int __init wlan_copy_ini_buf(void)
|
||||
{
|
||||
#include "wlan_cfg_ini.h"
|
||||
|
||||
size_t len = strlen(wlan_cfg) + 1;
|
||||
wlan_cfg_buf = kmalloc(len, GFP_KERNEL);
|
||||
memcpy(wlan_cfg_buf, wlan_cfg, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(wlan_copy_ini_buf);
|
||||
|
||||
@@ -5,6 +5,6 @@ if [ ! -e "$@" ] || [ -z "$@" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "static const char wlan_cfg[] = {"
|
||||
echo "const char wlan_cfg[] = {"
|
||||
cat "$@" | grep -ve '^$\|^#' | sed 's@\"@\\\\"@g' | while read line; do printf '\t\"%s\\n\"\n' "$line"; done
|
||||
echo "};"
|
||||
|
||||
Reference in New Issue
Block a user