summaryrefslogtreecommitdiff
path: root/drivers/net/ring
diff options
context:
space:
mode:
authorMauricio Vasquez B <mauricio.vasquez@polito.it>2016-11-02 08:46:09 -0500
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-11-07 14:50:47 +0100
commitf74ea27bb5d4e6dd0db39629e4fefd0d1851f8b5 (patch)
tree57544980356659ce719d048d4e5d8665d84730a1 /drivers/net/ring
parent25c62ca4eb0cb4bae0db9628ef343f246cc11820 (diff)
downloaddpdk-next-eventdev-f74ea27bb5d4e6dd0db39629e4fefd0d1851f8b5.zip
dpdk-next-eventdev-f74ea27bb5d4e6dd0db39629e4fefd0d1851f8b5.tar.gz
dpdk-next-eventdev-f74ea27bb5d4e6dd0db39629e4fefd0d1851f8b5.tar.xz
net/ring: remove unnecessary NULL check
Coverity detected this as an issue because internals->data will never be NULL, then the check is not necessary. Coverity issue: 137873 Fixes: d082c0395bf6 ("ring: fix memory leak when detaching") Signed-off-by: Mauricio Vasquez B <mauricio.vasquez@polito.it> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'drivers/net/ring')
-rw-r--r--drivers/net/ring/rte_eth_ring.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 6d2a8c1..c1767c4 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -599,24 +599,22 @@ rte_pmd_ring_remove(const char *name)
eth_dev_stop(eth_dev);
- if (eth_dev->data) {
- internals = eth_dev->data->dev_private;
- if (internals->action == DEV_CREATE) {
- /*
- * it is only necessary to delete the rings in rx_queues because
- * they are the same used in tx_queues
- */
- for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
- r = eth_dev->data->rx_queues[i];
- rte_ring_free(r->rng);
- }
+ internals = eth_dev->data->dev_private;
+ if (internals->action == DEV_CREATE) {
+ /*
+ * it is only necessary to delete the rings in rx_queues because
+ * they are the same used in tx_queues
+ */
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+ r = eth_dev->data->rx_queues[i];
+ rte_ring_free(r->rng);
}
-
- rte_free(eth_dev->data->rx_queues);
- rte_free(eth_dev->data->tx_queues);
- rte_free(eth_dev->data->dev_private);
}
+ rte_free(eth_dev->data->rx_queues);
+ rte_free(eth_dev->data->tx_queues);
+ rte_free(eth_dev->data->dev_private);
+
rte_free(eth_dev->data);
rte_eth_dev_release_port(eth_dev);