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
This commit is contained in:
wadesong
2016-10-13 20:56:56 +08:00
committed by qcabuildsw
parent f2e86b2814
commit 4e55519a5a
2 changed files with 6 additions and 4 deletions

View File

@@ -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

View File

@@ -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;