[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200911113326.GB367487@mwanda>
Date: Fri, 11 Sep 2020 14:33:26 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Lee Jones <lee.jones@...aro.org>
Cc: Ben Dooks <ben@...ff.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Vincent Sanders <vince@....linux.org.uk>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] 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@...cle.com>
---
drivers/mfd/sm501.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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:
--
2.28.0
Powered by blists - more mailing lists