diff mbox series

[59/82] net/netvsc: remove unnecessary NULL checks

Message ID 20220124000518.319850-60-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series remove unnecessary null checks | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 12:04 a.m. UTC
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/netvsc/hn_rxtx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Long Li Jan. 24, 2022, 8:09 p.m. UTC | #1
> Subject: [PATCH 59/82] net/netvsc: remove unnecessary NULL checks
> 
> Remove redundant NULL pointer checks before free functions found by
> nullfree.cocci
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Long Li <longli@microsoft.com>

> ---
>  drivers/net/netvsc/hn_rxtx.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index
> 50ca1710ef3e..3e3488f1b87a 100644
> --- a/drivers/net/netvsc/hn_rxtx.c
> +++ b/drivers/net/netvsc/hn_rxtx.c
> @@ -315,8 +315,7 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev,
>  	}
> 
>  error:
> -	if (txq->txdesc_pool)
> -		rte_mempool_free(txq->txdesc_pool);
> +	rte_mempool_free(txq->txdesc_pool);
>  	rte_memzone_free(txq->tx_rndis_mz);
>  	rte_free(txq);
>  	return err;
> @@ -365,8 +364,7 @@ hn_dev_tx_queue_release(struct rte_eth_dev *dev,
> uint16_t qid)
>  	if (!txq)
>  		return;
> 
> -	if (txq->txdesc_pool)
> -		rte_mempool_free(txq->txdesc_pool);
> +	rte_mempool_free(txq->txdesc_pool);
> 
>  	rte_memzone_free(txq->tx_rndis_mz);
>  	rte_free(txq);
> --
> 2.30.2
diff mbox series

Patch

diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 50ca1710ef3e..3e3488f1b87a 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -315,8 +315,7 @@  hn_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 error:
-	if (txq->txdesc_pool)
-		rte_mempool_free(txq->txdesc_pool);
+	rte_mempool_free(txq->txdesc_pool);
 	rte_memzone_free(txq->tx_rndis_mz);
 	rte_free(txq);
 	return err;
@@ -365,8 +364,7 @@  hn_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 	if (!txq)
 		return;
 
-	if (txq->txdesc_pool)
-		rte_mempool_free(txq->txdesc_pool);
+	rte_mempool_free(txq->txdesc_pool);
 
 	rte_memzone_free(txq->tx_rndis_mz);
 	rte_free(txq);