[PATCH 1/3] bus/fslmc: remove unnecessary null check

Stephen Hemminger stephen at networkplumber.org
Tue Nov 12 18:38:01 CET 2024


No need for check for null before calling free().
Caught by nullfree.cocci script.

Fixes: 57cb02edf122 ("bus/fslmc: enhance MC VFIO multi-process support")
Cc: jun.yang at nxp.com

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/bus/fslmc/fslmc_vfio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index c581dcc4e2..7a584b9280 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -557,8 +557,7 @@ fslmc_vfio_open_container_fd(void)
 	return vfio_container_fd;
 
 err_exit:
-	if (mp_reply.msgs)
-		free(mp_reply.msgs);
+	free(mp_reply.msgs);
 	DPAA2_BUS_ERR("Open container fd err(%d)", ret);
 	return ret;
 }
-- 
2.45.2



More information about the dev mailing list