qcacmn: Fix mem leaks in datapath
Fix mem leaks reported in datapath code during module unload. Change-Id: Ife95426df11d61b253110ed7153fe8f8981006ed CRs-fixed: 2044907
This commit is contained in:

committed by
snandini

parent
ae6d6f42ec
commit
b01696ba61
@@ -1371,6 +1371,7 @@ static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force)
|
|||||||
|
|
||||||
soc->pdev_list[pdev->pdev_id] = NULL;
|
soc->pdev_list[pdev->pdev_id] = NULL;
|
||||||
soc->pdev_count--;
|
soc->pdev_count--;
|
||||||
|
wlan_cfg_pdev_detach(pdev->wlan_cfg_ctx);
|
||||||
qdf_mem_free(pdev);
|
qdf_mem_free(pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1427,10 +1428,9 @@ static void dp_soc_detach_wifi3(void *txrx_soc)
|
|||||||
/* Common rings */
|
/* Common rings */
|
||||||
dp_srng_cleanup(soc, &soc->wbm_desc_rel_ring, SW2WBM_RELEASE, 0);
|
dp_srng_cleanup(soc, &soc->wbm_desc_rel_ring, SW2WBM_RELEASE, 0);
|
||||||
|
|
||||||
|
dp_tx_soc_detach(soc);
|
||||||
/* Tx data rings */
|
/* Tx data rings */
|
||||||
if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) {
|
if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) {
|
||||||
dp_tx_soc_detach(soc);
|
|
||||||
|
|
||||||
for (i = 0; i < soc->num_tcl_data_rings; i++) {
|
for (i = 0; i < soc->num_tcl_data_rings; i++) {
|
||||||
dp_srng_cleanup(soc, &soc->tcl_data_ring[i],
|
dp_srng_cleanup(soc, &soc->tcl_data_ring[i],
|
||||||
TCL_DATA, i);
|
TCL_DATA, i);
|
||||||
@@ -1477,6 +1477,7 @@ static void dp_soc_detach_wifi3(void *txrx_soc)
|
|||||||
htt_soc_detach(soc->htt_handle);
|
htt_soc_detach(soc->htt_handle);
|
||||||
|
|
||||||
dp_reo_desc_freelist_destroy(soc);
|
dp_reo_desc_freelist_destroy(soc);
|
||||||
|
wlan_cfg_soc_detach(soc->wlan_cfg_ctx);
|
||||||
qdf_mem_free(soc);
|
qdf_mem_free(soc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,11 +55,13 @@ QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc, uint32_t pool_id,
|
|||||||
rx_desc_pool->array[i].next = &rx_desc_pool->array[i+1];
|
rx_desc_pool->array[i].next = &rx_desc_pool->array[i+1];
|
||||||
rx_desc_pool->array[i].rx_desc.cookie = i | (pool_id << 18);
|
rx_desc_pool->array[i].rx_desc.cookie = i | (pool_id << 18);
|
||||||
rx_desc_pool->array[i].rx_desc.pool_id = pool_id;
|
rx_desc_pool->array[i].rx_desc.pool_id = pool_id;
|
||||||
|
rx_desc_pool->array[i].rx_desc.nbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rx_desc_pool->array[i].next = NULL;
|
rx_desc_pool->array[i].next = NULL;
|
||||||
rx_desc_pool->array[i].rx_desc.cookie = i | (pool_id << 18);
|
rx_desc_pool->array[i].rx_desc.cookie = i | (pool_id << 18);
|
||||||
rx_desc_pool->array[i].rx_desc.pool_id = pool_id;
|
rx_desc_pool->array[i].rx_desc.pool_id = pool_id;
|
||||||
|
rx_desc_pool->array[i].rx_desc.nbuf = NULL;
|
||||||
qdf_spin_unlock_bh(&soc->rx_desc_mutex[pool_id]);
|
qdf_spin_unlock_bh(&soc->rx_desc_mutex[pool_id]);
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -75,8 +77,13 @@ QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc, uint32_t pool_id,
|
|||||||
void dp_rx_desc_pool_free(struct dp_soc *soc, uint32_t pool_id,
|
void dp_rx_desc_pool_free(struct dp_soc *soc, uint32_t pool_id,
|
||||||
struct rx_desc_pool *rx_desc_pool)
|
struct rx_desc_pool *rx_desc_pool)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
qdf_spin_lock_bh(&soc->rx_desc_mutex[pool_id]);
|
qdf_spin_lock_bh(&soc->rx_desc_mutex[pool_id]);
|
||||||
|
for (i = 0; i < rx_desc_pool->pool_size; i++) {
|
||||||
|
if (rx_desc_pool->array[i].rx_desc.nbuf)
|
||||||
|
qdf_nbuf_free(rx_desc_pool->array[i].rx_desc.nbuf);
|
||||||
|
}
|
||||||
qdf_mem_free(rx_desc_pool->array);
|
qdf_mem_free(rx_desc_pool->array);
|
||||||
qdf_spin_unlock_bh(&soc->rx_desc_mutex[pool_id]);
|
qdf_spin_unlock_bh(&soc->rx_desc_mutex[pool_id]);
|
||||||
}
|
}
|
||||||
|
@@ -1310,6 +1310,8 @@ static void hif_pm_runtime_close(struct hif_pci_softc *sc)
|
|||||||
{
|
{
|
||||||
struct hif_softc *scn = HIF_GET_SOFTC(sc);
|
struct hif_softc *scn = HIF_GET_SOFTC(sc);
|
||||||
|
|
||||||
|
hif_runtime_lock_deinit(GET_HIF_OPAQUE_HDL(sc),
|
||||||
|
sc->prevent_linkdown_lock);
|
||||||
if (qdf_atomic_read(&sc->pm_state) == HIF_PM_RUNTIME_STATE_NONE)
|
if (qdf_atomic_read(&sc->pm_state) == HIF_PM_RUNTIME_STATE_NONE)
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
@@ -4400,20 +4402,17 @@ void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
|
|||||||
struct hif_pm_runtime_lock *context = data;
|
struct hif_pm_runtime_lock *context = data;
|
||||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
|
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
|
||||||
|
|
||||||
if (!sc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure to delete the context list entry and reduce the usage count
|
* Ensure to delete the context list entry and reduce the usage count
|
||||||
* before freeing the context if context is active.
|
* before freeing the context if context is active.
|
||||||
*/
|
*/
|
||||||
|
if (sc) {
|
||||||
spin_lock_bh(&sc->runtime_lock);
|
spin_lock_bh(&sc->runtime_lock);
|
||||||
__hif_pm_runtime_allow_suspend(sc, context);
|
__hif_pm_runtime_allow_suspend(sc, context);
|
||||||
spin_unlock_bh(&sc->runtime_lock);
|
spin_unlock_bh(&sc->runtime_lock);
|
||||||
|
}
|
||||||
qdf_mem_free(context);
|
qdf_mem_free(context);
|
||||||
}
|
}
|
||||||
#endif /* FEATURE_RUNTIME_PM */
|
#endif /* FEATURE_RUNTIME_PM */
|
||||||
|
Reference in New Issue
Block a user