diff mbox series

[v2,20/83] bus/fslmc: remove unnecessary NULL checks

Message ID 20220124174719.14417-21-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 warning coding style issues

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>
Acked-by:  Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c            | 6 ++----
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 53fd75539e98..30d019516b91 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -223,13 +223,11 @@  scan_one_fslmc_device(char *dev_name)
 	insert_in_device_list(dev);
 
 	/* Don't need the duplicated device filesystem entry anymore */
-	if (dup_dev_name)
-		free(dup_dev_name);
+	free(dup_dev_name);
 
 	return 0;
 cleanup:
-	if (dup_dev_name)
-		free(dup_dev_name);
+	free(dup_dev_name);
 	if (dev) {
 		rte_intr_instance_free(dev->intr_handle);
 		free(dev);
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 52605ea2c32c..943fadee4816 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -149,8 +149,7 @@  dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int cpu_id)
 	if (!token) {
 		DPAA2_BUS_WARN("Failed to get interrupt id for dpio.%d",
 			       dpio_id);
-		if (temp)
-			free(temp);
+		free(temp);
 		fclose(file);
 		return;
 	}
@@ -574,8 +573,7 @@  dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage)
 	int i = 0;
 
 	for (i = 0; i < NUM_DQS_PER_QUEUE; i++) {
-		if (q_storage->dq_storage[i])
-			rte_free(q_storage->dq_storage[i]);
+		rte_free(q_storage->dq_storage[i]);
 	}
 }