diff mbox series

[v2,63/83] net/qede: remove unnecessary NULL checks

Message ID 20220124174719.14417-64-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/qede/qede_main.c | 3 +--
 drivers/net/qede/qede_rxtx.c | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)

Comments

Devendra Singh Rawat Jan. 25, 2022, 3:53 a.m. UTC | #1
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Monday, January 24, 2022 11:17 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Rasesh Mody
> <rmody@marvell.com>; Devendra Singh Rawat <dsinghrawat@marvell.com>
> Subject: [EXT] [PATCH v2 63/83] net/qede: remove unnecessary NULL checks
> 
> External Email
> 
> ----------------------------------------------------------------------
> Remove redundant NULL pointer checks before free functions found by
> nullfree.cocci
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/qede/qede_main.c | 3 +--
>  drivers/net/qede/qede_rxtx.c | 6 ++----
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
> index 2d1f70693a3d..ad101194d613 100644
> --- a/drivers/net/qede/qede_main.c
> +++ b/drivers/net/qede/qede_main.c
> @@ -335,8 +335,7 @@ static int qed_slowpath_start(struct ecore_dev *edev,
>  err:
>  #ifdef CONFIG_ECORE_BINARY_FW
>  	if (IS_PF(edev)) {
> -		if (edev->firmware)
> -			rte_free(edev->firmware);
> +		rte_free(edev->firmware);
>  		edev->firmware = NULL;
>  	}
>  #endif
> diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index
> 7088c57b501d..1c0a6ba5f1bf 100644
> --- a/drivers/net/qede/qede_rxtx.c
> +++ b/drivers/net/qede/qede_rxtx.c
> @@ -706,12 +706,10 @@ void qede_dealloc_fp_resc(struct rte_eth_dev
> *eth_dev)
>  		}
>  	}
> 
> -	if (qdev->fp_array)
> -		rte_free(qdev->fp_array);
> +	rte_free(qdev->fp_array);
>  	qdev->fp_array = NULL;
> 
> -	if (qdev->fp_array_cmt)
> -		rte_free(qdev->fp_array_cmt);
> +	rte_free(qdev->fp_array_cmt);
>  	qdev->fp_array_cmt = NULL;
>  }
> 
> --
> 2.30.2


Acked-by: Devendra Singh Rawat <dsinghrawat@marvell.com>

Thanks,
Devendra
diff mbox series

Patch

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index 2d1f70693a3d..ad101194d613 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -335,8 +335,7 @@  static int qed_slowpath_start(struct ecore_dev *edev,
 err:
 #ifdef CONFIG_ECORE_BINARY_FW
 	if (IS_PF(edev)) {
-		if (edev->firmware)
-			rte_free(edev->firmware);
+		rte_free(edev->firmware);
 		edev->firmware = NULL;
 	}
 #endif
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 7088c57b501d..1c0a6ba5f1bf 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -706,12 +706,10 @@  void qede_dealloc_fp_resc(struct rte_eth_dev *eth_dev)
 		}
 	}
 
-	if (qdev->fp_array)
-		rte_free(qdev->fp_array);
+	rte_free(qdev->fp_array);
 	qdev->fp_array = NULL;
 
-	if (qdev->fp_array_cmt)
-		rte_free(qdev->fp_array_cmt);
+	rte_free(qdev->fp_array_cmt);
 	qdev->fp_array_cmt = NULL;
 }