diff mbox series

[v2,22/83] bus/pci: remove unnecessary NULL checks

Message ID 20220124174719.14417-23-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/bus/pci/pci_params.c         | 3 +--
 drivers/bus/pci/windows/pci.c        | 3 +--
 drivers/bus/pci/windows/pci_netuio.c | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 60b424b8297e..61a868707f16 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -117,8 +117,7 @@  rte_pci_devargs_parse(struct rte_devargs *da)
 	rte_pci_device_name(&addr, da->name, sizeof(da->name));
 
 out:
-	if (kvargs != NULL)
-		rte_kvargs_free(kvargs);
+	rte_kvargs_free(kvargs);
 	if (ret != 0)
 		rte_errno = -ret;
 	return ret;
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 39ba31be7d38..7bf091158ba2 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -418,8 +418,7 @@  pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 
 	return 0;
 end:
-	if (dev)
-		free(dev);
+	free(dev);
 	return ret;
 }
 
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index a0b175a8fca0..5460399eea5f 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -180,8 +180,7 @@  get_netuio_device_info(HDEVINFO dev_info, PSP_DEVINFO_DATA dev_info_data,
 			CloseHandle(netuio);
 	}
 
-	if (dev_ifx_detail)
-		free(dev_ifx_detail);
+	free(dev_ifx_detail);
 
 	if (di_set != INVALID_HANDLE_VALUE)
 		SetupDiDestroyDeviceInfoList(di_set);