[PATCH V2 4/5] mmc: fsl_esdhc_imx: Avoid resource leak

Peng Fan (OSS) peng.fan at oss.nxp.com
Tue Oct 1 15:07:56 CEST 2024


From: Ye Li <ye.li at nxp.com>

The memory of priv and plat are leaked if max_bus_width is wrong.

Signed-off-by: Ye Li <ye.li at nxp.com>
Reviewed-by: Peng Fan <peng.fan at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---

V2:
 None

 drivers/mmc/fsl_esdhc_imx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index a3defe952b2..debfc78b7f0 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1327,6 +1327,8 @@ int fsl_esdhc_initialize(struct bd_info *bis, struct fsl_esdhc_cfg *cfg)
 		break;
 	default:
 		printf("invalid max bus width %u\n", cfg->max_bus_width);
+		free(plat);
+		free(priv);
 		return -EINVAL;
 	}
 
-- 
2.35.3



More information about the U-Boot mailing list