diff mbox series

[53/82] net/igc: remove unnecessary NULL checks

Message ID 20220124000518.319850-54-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/igc/igc_flow.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Wang, Haiyue Jan. 24, 2022, 12:49 a.m. UTC | #1
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Monday, January 24, 2022 08:05
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Wang, Haiyue <haiyue.wang@intel.com>
> Subject: [PATCH 53/82] net/igc: remove unnecessary NULL checks
> 
> Remove redundant NULL pointer checks before free functions
> found by nullfree.cocci
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/igc/igc_flow.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/igc/igc_flow.c b/drivers/net/igc/igc_flow.c
> index 66053060af5a..88978ee0e849 100644
> --- a/drivers/net/igc/igc_flow.c
> +++ b/drivers/net/igc/igc_flow.c
> @@ -776,8 +776,7 @@ igc_flow_create(struct rte_eth_dev *dev,
> 
>  	if (ret) {
>  		/* check and free the memory */

This comment line can be removed either, since 'check' is done by 'rte_free'
internally.

> -		if (flow)
> -			rte_free(flow);
> +		rte_free(flow);
> 
>  		rte_flow_error_set(error, -ret,
>  				RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> --
> 2.30.2
diff mbox series

Patch

diff --git a/drivers/net/igc/igc_flow.c b/drivers/net/igc/igc_flow.c
index 66053060af5a..88978ee0e849 100644
--- a/drivers/net/igc/igc_flow.c
+++ b/drivers/net/igc/igc_flow.c
@@ -776,8 +776,7 @@  igc_flow_create(struct rte_eth_dev *dev,
 
 	if (ret) {
 		/* check and free the memory */
-		if (flow)
-			rte_free(flow);
+		rte_free(flow);
 
 		rte_flow_error_set(error, -ret,
 				RTE_FLOW_ERROR_TYPE_HANDLE, NULL,