فهرست منبع

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
wadesong 8 سال پیش
والد
کامیت
4e55519a5a
2فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 1 0
      core/sap/dfs/inc/dfs.h
  2. 5 4
      core/sap/dfs/src/dfs.c

+ 1 - 0
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
 

+ 5 - 4
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;