[dpdk-dev] [PATCH 02/21] net/qede/base: fix to set pointers to NULL after freeing
Rasesh Mody
rasesh.mody at cavium.com
Mon Feb 27 08:51:44 CET 2017
Set pointers to NULL after freeing the allocations on ecore_resc_free().
Fixes: 26ae839d06e9 ("qede: add DCBX support")
Fixes: ec94dbc57362 ("qede: add base driver")
Signed-off-by: Rasesh Mody <rasesh.mody at cavium.com>
---
drivers/net/qede/base/ecore_dcbx.c | 2 +-
drivers/net/qede/base/ecore_dev.c | 4 ++--
drivers/net/qede/base/ecore_spq.c | 2 ++
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/qede/base/ecore_dcbx.c b/drivers/net/qede/base/ecore_dcbx.c
index 7380fd8..9ce6dc4 100644
--- a/drivers/net/qede/base/ecore_dcbx.c
+++ b/drivers/net/qede/base/ecore_dcbx.c
@@ -914,7 +914,7 @@ enum _ecore_status_t ecore_dcbx_info_alloc(struct ecore_hwfn *p_hwfn)
void ecore_dcbx_info_free(struct ecore_hwfn *p_hwfn,
struct ecore_dcbx_info *p_dcbx_info)
{
- OSAL_FREE(p_hwfn->p_dev, p_hwfn->p_dcbx_info);
+ p_hwfn->p_dcbx_info = OSAL_NULL;
}
static void ecore_dcbx_update_protocol_data(struct protocol_dcb_data *p_data,
diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c
index 0518fc7..15051b6 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -156,6 +156,7 @@ void ecore_resc_free(struct ecore_dev *p_dev)
p_dev->fw_data = OSAL_NULL;
OSAL_FREE(p_dev, p_dev->reset_stats);
+ p_dev->reset_stats = OSAL_NULL;
for_each_hwfn(p_dev, i) {
struct ecore_hwfn *p_hwfn = &p_dev->hwfns[i];
@@ -668,8 +669,7 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev)
DP_ERR(p_hwfn, "Cannot allocate 0x%x EQ elements."
"The maximum of a u16 chain is 0x%x\n",
n_eqes, 0xFFFF);
- rc = ECORE_INVAL;
- goto alloc_err;
+ goto alloc_no_mem;
}
p_eq = ecore_eq_alloc(p_hwfn, (u16)n_eqes);
diff --git a/drivers/net/qede/base/ecore_spq.c b/drivers/net/qede/base/ecore_spq.c
index 1f35d6c..d55a448 100644
--- a/drivers/net/qede/base/ecore_spq.c
+++ b/drivers/net/qede/base/ecore_spq.c
@@ -402,6 +402,7 @@ void ecore_eq_free(struct ecore_hwfn *p_hwfn, struct ecore_eq *p_eq)
return;
ecore_chain_free(p_hwfn->p_dev, &p_eq->chain);
OSAL_FREE(p_hwfn->p_dev, p_eq);
+ p_eq = OSAL_NULL;
}
/***************************************************************************
@@ -987,4 +988,5 @@ void ecore_consq_free(struct ecore_hwfn *p_hwfn, struct ecore_consq *p_consq)
return;
ecore_chain_free(p_hwfn->p_dev, &p_consq->chain);
OSAL_FREE(p_hwfn->p_dev, p_consq);
+ p_consq = OSAL_NULL;
}
--
1.7.10.3
More information about the dev
mailing list