From 49908e739e23e2672d3efb9b1a35f877f8e86342 Mon Sep 17 00:00:00 2001 From: Alexander Beregalov Date: Fri, 5 Mar 2010 13:44:19 -0800 Subject: [PATCH] rtc: mxc: fix memory leak Free pdata before exit. Found by cppcheck. [yuasa@linux-mips.org: add missing iounmap()] Signed-off-by: Alexander Beregalov Reviewed-by: WANG Cong Acked-by: Daniel Mack Acked-by: Alessandro Zummo Cc Yoichi Yuasa Cc: Paul Gortmaker Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/rtc/rtc-mxc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 6bd5072d4eb7..8710f9415d98 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c @@ -396,8 +396,11 @@ static int __init mxc_rtc_probe(struct platform_device *pdev) pdata->ioaddr = ioremap(res->start, resource_size(res)); clk = clk_get(&pdev->dev, "ckil"); - if (IS_ERR(clk)) - return PTR_ERR(clk); + if (IS_ERR(clk)) { + iounmap(pdata->ioaddr); + ret = PTR_ERR(clk); + goto exit_free_pdata; + } rate = clk_get_rate(clk); clk_put(clk); -- 2.20.1