|
@@ -215,6 +215,44 @@ static int dfs_get_debug_info(struct ieee80211com *ic, int type, void *data)
|
|
|
return (int)dfs->dfs_proc_phyerr;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * dfs_alloc_mem_filter() - allocate memory for dfs ft_filters
|
|
|
+ * @radarf: pointer holding ft_filters
|
|
|
+ *
|
|
|
+ * Return: 0-success and 1-failure
|
|
|
+*/
|
|
|
+static int dfs_alloc_mem_filter(struct dfs_filtertype *radarf)
|
|
|
+{
|
|
|
+ int status = 0, n, i;
|
|
|
+
|
|
|
+ for (i = 0; i < DFS_MAX_NUM_RADAR_FILTERS; i++) {
|
|
|
+ radarf->ft_filters[i] = qdf_mem_malloc(sizeof(struct
|
|
|
+ dfs_filter));
|
|
|
+ if (NULL == radarf->ft_filters[i]) {
|
|
|
+ DFS_PRINTK("%s[%d]: mem alloc failed\n",
|
|
|
+ __func__, __LINE__);
|
|
|
+ status = 1;
|
|
|
+ goto error;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return status;
|
|
|
+
|
|
|
+error:
|
|
|
+ /* free up allocated memory */
|
|
|
+ for (n = 0; n < i; n++) {
|
|
|
+ if (radarf->ft_filters[n]) {
|
|
|
+ qdf_mem_free(radarf->ft_filters[n]);
|
|
|
+ radarf->ft_filters[i] = NULL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ DFS_PRINTK("%s[%d]: cannot allocate memory for radar filter types\n",
|
|
|
+ __func__, __LINE__);
|
|
|
+
|
|
|
+ return status;
|
|
|
+}
|
|
|
+
|
|
|
int dfs_attach(struct ieee80211com *ic)
|
|
|
{
|
|
|
int i, n;
|
|
@@ -325,18 +363,20 @@ int dfs_attach(struct ieee80211com *ic)
|
|
|
|
|
|
/* Allocate memory for radar filters */
|
|
|
for (n = 0; n < DFS_MAX_RADAR_TYPES; n++) {
|
|
|
- dfs->dfs_radarf[n] =
|
|
|
- (struct dfs_filtertype *)os_malloc(NULL,
|
|
|
- sizeof(struct
|
|
|
- dfs_filtertype),
|
|
|
- GFP_ATOMIC);
|
|
|
+ dfs->dfs_radarf[n] = (struct dfs_filtertype *)
|
|
|
+ os_malloc(NULL, sizeof(struct dfs_filtertype),
|
|
|
+ GFP_ATOMIC);
|
|
|
if (dfs->dfs_radarf[n] == NULL) {
|
|
|
DFS_PRINTK
|
|
|
("%s: cannot allocate memory for radar filter types\n",
|
|
|
__func__);
|
|
|
goto bad1;
|
|
|
+ } else {
|
|
|
+ qdf_mem_zero(dfs->dfs_radarf[n],
|
|
|
+ sizeof(struct dfs_filtertype));
|
|
|
+ if (0 != dfs_alloc_mem_filter(dfs->dfs_radarf[n]))
|
|
|
+ goto bad1;
|
|
|
}
|
|
|
- OS_MEMZERO(dfs->dfs_radarf[n], sizeof(struct dfs_filtertype));
|
|
|
}
|
|
|
/* Allocate memory for radar table */
|
|
|
dfs->dfs_radartable =
|
|
@@ -431,6 +471,23 @@ bad1:
|
|
|
#undef N
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * dfs_free_filter() - free memory allocated for dfs ft_filters
|
|
|
+ * @radarf: pointer holding ft_filters
|
|
|
+ *
|
|
|
+ * Return: NA
|
|
|
+*/
|
|
|
+static void dfs_free_filter(struct dfs_filtertype *radarf)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+
|
|
|
+ for (i = 0; i < DFS_MAX_NUM_RADAR_FILTERS; i++) {
|
|
|
+ if (radarf->ft_filters[i]) {
|
|
|
+ qdf_mem_free(radarf->ft_filters[i]);
|
|
|
+ radarf->ft_filters[i] = NULL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
void dfs_detach(struct ieee80211com *ic)
|
|
|
{
|
|
|
struct ath_dfs *dfs = (struct ath_dfs *)ic->ic_dfs;
|
|
@@ -496,6 +553,7 @@ void dfs_detach(struct ieee80211com *ic)
|
|
|
|
|
|
for (n = 0; n < DFS_MAX_RADAR_TYPES; n++) {
|
|
|
if (dfs->dfs_radarf[n] != NULL) {
|
|
|
+ dfs_free_filter(dfs->dfs_radarf[n]);
|
|
|
OS_FREE(dfs->dfs_radarf[n]);
|
|
|
dfs->dfs_radarf[n] = NULL;
|
|
|
}
|