Skip to contentSkip to conversation

mfd: sm501: Fix leaks in probe()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 11, 2020 – Sep 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: sm501: Fix leaks in probe()

This code should clean up if sm501_init_dev() fails.

Fixes b6d6454fdb66 ("[PATCH] mfd: SM501 core driver")
---
 drivers/mfd/sm501.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mfd/sm501.c +7 -1
index ccd62b963952..6d2f4a0a901d 100644
@@ -1415,8 +1415,14 @@ static int sm501_plat_probe(struct platform_device *dev)
 		goto err_claim;
 	}
 
-	return sm501_init_dev(sm);
+	ret = sm501_init_dev(sm);
+	if (ret)
+		goto err_unmap;
+
+	return 0;
 
+ err_unmap:
+	iounmap(sm->regs);
  err_claim:
 	release_mem_region(sm->io_res->start, 0x100);
  err_res:
Signature · 1 line
2.28.0
Applied
#1 lore raw
Quoted 7 lines · Dan Carpenter

This code should clean up if sm501_init_dev() fails.

Fixes b6d6454fdb66 ("[PATCH] mfd: SM501 core driver")
---
 drivers/mfd/sm501.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog