summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/sm501.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-09-11 13:33:26 +0200
committerLee Jones <lee.jones@linaro.org>2020-09-30 17:25:19 +0200
commit8ce24f8967df2836b4557a23e74dc4bb098249f1 (patch)
treefce0e028a7e8f58c7f4327bb8cbd3e966b23158d /drivers/mfd/sm501.c
parentmfd: syscon: Don't free allocated name for regmap_config (diff)
downloadlinux-8ce24f8967df2836b4557a23e74dc4bb098249f1.tar.xz
linux-8ce24f8967df2836b4557a23e74dc4bb098249f1.zip
mfd: sm501: Fix leaks in probe()
This code should clean up if sm501_init_dev() fails. Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/sm501.c')
-rw-r--r--drivers/mfd/sm501.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index ccd62b963952..6d2f4a0a901d 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -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: