From 4e55519a5afa37defd9e4e51cc45709ba5b43ef8 Mon Sep 17 00:00:00 2001 From: wadesong Date: Thu, 13 Oct 2016 20:56:56 +0800 Subject: [PATCH] qcacld-3.0: Replace literal number usage with a proper macro qcacld-2.0 to qcacld-3.0 propagation A macro should be used for radar table allocation/freeing instead of a literal number Change-Id: Iccf2aee57f52dedeebb87f1445edd9d30bbdeec3 CRs-Fixed: 1072046 --- core/sap/dfs/inc/dfs.h | 1 + core/sap/dfs/src/dfs.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/sap/dfs/inc/dfs.h b/core/sap/dfs/inc/dfs.h index 914e007b2c4b..0cb01d7deda9 100644 --- a/core/sap/dfs/inc/dfs.h +++ b/core/sap/dfs/inc/dfs.h @@ -127,6 +127,7 @@ enum { /* use 145 for osprey conversion is already done using dfs->dur_multiplier */ #define MAX_BIN5_DUR 145 #define MAX_BIN5_DUR_MICROSEC 105 +#define MAX_DFS_RADAR_TABLE_TYPE 256 #define DFS_BIN5_TIME_WINDOW_UNITS_MULTIPLIER 1000000 diff --git a/core/sap/dfs/src/dfs.c b/core/sap/dfs/src/dfs.c index c7c47b9a211e..dacb8ad86069 100644 --- a/core/sap/dfs/src/dfs.c +++ b/core/sap/dfs/src/dfs.c @@ -398,13 +398,14 @@ int dfs_attach(struct ieee80211com *ic) } /* Allocate memory for radar table */ dfs->dfs_radartable = - (int8_t **) os_malloc(NULL, 256 * sizeof(int8_t *), GFP_ATOMIC); + (int8_t **) os_malloc(NULL, + MAX_DFS_RADAR_TABLE_TYPE * sizeof(int8_t *), GFP_ATOMIC); if (dfs->dfs_radartable == NULL) { DFS_PRINTK("%s: cannot allocate memory for radar table\n", __func__); goto bad1; } - for (n = 0; n < 256; n++) { + for (n = 0; n < MAX_DFS_RADAR_TABLE_TYPE; n++) { dfs->dfs_radartable[n] = os_malloc(NULL, DFS_MAX_RADAR_OVERLAP * sizeof(int8_t), GFP_ATOMIC); @@ -458,7 +459,7 @@ int dfs_attach(struct ieee80211com *ic) return 0; bad2: - for (n = 0; n < 256; n++) { + for (n = 0; n < MAX_DFS_RADAR_TABLE_TYPE; n++) { if (dfs->dfs_radartable[n] != NULL) { OS_FREE(dfs->dfs_radartable[n]); dfs->dfs_radartable[n] = NULL; @@ -568,7 +569,7 @@ void dfs_detach(struct ieee80211com *ic) } if (dfs->dfs_radartable != NULL) { - for (n = 0; n < 256; n++) { + for (n = 0; n < MAX_DFS_RADAR_TABLE_TYPE; n++) { if (dfs->dfs_radartable[n] != NULL) { OS_FREE(dfs->dfs_radartable[n]); dfs->dfs_radartable[n] = NULL;