[v2] net/octeontx2: remove logically dead code

Message ID 1602247145-14676-1-git-send-email-wangyunjian@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2] net/octeontx2: remove logically dead code |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Yunjian Wang Oct. 9, 2020, 12:39 p.m. UTC
  From: Yunjian Wang <wangyunjian@huawei.com>

The glibc free allows free(NULL) as null operation,
so remove this useless null checks.

Coverity issue: 357719
Fixes: da138cd47e06 ("net/octeontx2: handle port reconfigure")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
v2:
   fix code styles suggested by Stephen Hemminger
---
 drivers/net/octeontx2/otx2_ethdev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Jerin Jacob Oct. 11, 2020, 9:49 a.m. UTC | #1
On Fri, Oct 9, 2020 at 6:09 PM wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> The glibc free allows free(NULL) as null operation,
> so remove this useless null checks.
>
> Coverity issue: 357719
> Fixes: da138cd47e06 ("net/octeontx2: handle port reconfigure")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/for-main. Thanks

> ---
> v2:
>    fix code styles suggested by Stephen Hemminger
> ---
>  drivers/net/octeontx2/otx2_ethdev.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
> index 03d81faef..b69b92bf5 100644
> --- a/drivers/net/octeontx2/otx2_ethdev.c
> +++ b/drivers/net/octeontx2/otx2_ethdev.c
> @@ -1383,10 +1383,8 @@ nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
>         return 0;
>
>  fail:
> -       if (tx_qconf)
> -               free(tx_qconf);
> -       if (rx_qconf)
> -               free(rx_qconf);
> +       free(tx_qconf);
> +       free(rx_qconf);
>
>         return -ENOMEM;
>  }
> --
> 2.23.0
>
  

Patch

diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 03d81faef..b69b92bf5 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1383,10 +1383,8 @@  nix_store_queue_cfg_and_then_release(struct rte_eth_dev *eth_dev)
 	return 0;
 
 fail:
-	if (tx_qconf)
-		free(tx_qconf);
-	if (rx_qconf)
-		free(rx_qconf);
+	free(tx_qconf);
+	free(rx_qconf);
 
 	return -ENOMEM;
 }