Commit 49908e739e23e2672d3efb9b1a35f877f8e86342

Authored by Alexander Beregalov
Committed by Linus Torvalds
1 parent 27fb7f009b

rtc: mxc: fix memory leak

Free pdata before exit.  Found by cppcheck.

[yuasa@linux-mips.org: add missing iounmap()]
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Cc Yoichi Yuasa <yuasa@linux-mips.org>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

drivers/rtc/rtc-mxc.c
... ... @@ -396,8 +396,11 @@
396 396 pdata->ioaddr = ioremap(res->start, resource_size(res));
397 397  
398 398 clk = clk_get(&pdev->dev, "ckil");
399   - if (IS_ERR(clk))
400   - return PTR_ERR(clk);
  399 + if (IS_ERR(clk)) {
  400 + iounmap(pdata->ioaddr);
  401 + ret = PTR_ERR(clk);
  402 + goto exit_free_pdata;
  403 + }
401 404  
402 405 rate = clk_get_rate(clk);
403 406 clk_put(clk);