diff mbox series

[v2,50/83] net/hns3: remove unnecessary NULL checks

Message ID 20220124174719.14417-51-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, 5:46 p.m. UTC
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/hns3/hns3_rxtx.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Min Hu (Connor) Jan. 25, 2022, 12:49 a.m. UTC | #1
Acked-by: Min Hu (Connor) <humin29@huawei.com>

在 2022/1/25 1:46, Stephen Hemminger 写道:
> Remove redundant NULL pointer checks before free functions
> found by nullfree.cocci
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   drivers/net/hns3/hns3_rxtx.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
> index d240e36e6a86..8a428f88f48e 100644
> --- a/drivers/net/hns3/hns3_rxtx.c
> +++ b/drivers/net/hns3/hns3_rxtx.c
> @@ -86,8 +86,7 @@ hns3_rx_queue_release(void *queue)
>   		hns3_rx_queue_release_mbufs(rxq);
>   		if (rxq->mz)
>   			rte_memzone_free(rxq->mz);
> -		if (rxq->sw_ring)
> -			rte_free(rxq->sw_ring);
> +		rte_free(rxq->sw_ring);
>   		rte_free(rxq);
>   	}
>   }
> @@ -100,10 +99,8 @@ hns3_tx_queue_release(void *queue)
>   		hns3_tx_queue_release_mbufs(txq);
>   		if (txq->mz)
>   			rte_memzone_free(txq->mz);
> -		if (txq->sw_ring)
> -			rte_free(txq->sw_ring);
> -		if (txq->free)
> -			rte_free(txq->free);
> +		rte_free(txq->sw_ring);
> +		rte_free(txq->free);
>   		rte_free(txq);
>   	}
>   }
>
diff mbox series

Patch

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index d240e36e6a86..8a428f88f48e 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -86,8 +86,7 @@  hns3_rx_queue_release(void *queue)
 		hns3_rx_queue_release_mbufs(rxq);
 		if (rxq->mz)
 			rte_memzone_free(rxq->mz);
-		if (rxq->sw_ring)
-			rte_free(rxq->sw_ring);
+		rte_free(rxq->sw_ring);
 		rte_free(rxq);
 	}
 }
@@ -100,10 +99,8 @@  hns3_tx_queue_release(void *queue)
 		hns3_tx_queue_release_mbufs(txq);
 		if (txq->mz)
 			rte_memzone_free(txq->mz);
-		if (txq->sw_ring)
-			rte_free(txq->sw_ring);
-		if (txq->free)
-			rte_free(txq->free);
+		rte_free(txq->sw_ring);
+		rte_free(txq->free);
 		rte_free(txq);
 	}
 }