Skip to contentSkip to conversation

rtc: mxc: fix memory leak

PATCH In review Alexander Beregalov 3 participants 3 messages Jan 9, 2010

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

PATCH 1/1 rtc: mxc: fix memory leak

Free pdata before exit.
Found by cppcheck.

---
 drivers/rtc/rtc-mxc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-mxc.c +4 -2
index 6bd5072..2642e6b 100644
@@ -396,8 +396,10 @@ 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)) {
+		ret = PTR_ERR(clk);
+		goto exit_free_pdata;
+	}
 
 	rate = clk_get_rate(clk);
 	clk_put(clk);
Signature · 1 line
1.6.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Alexander Beregalov

Free pdata before exit.
Found by cppcheck.

This patch looks fine for me.

Thanks!

Quoted 29 lines

---
drivers/rtc/rtc-mxc.c | 6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-mxc.c +4 -2
index 6bd5072..2642e6b 100644
@@ -396,8 +396,10 @@ 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)) {
+		ret = PTR_ERR(clk);
+		goto exit_free_pdata;
+	}
 
 	rate = clk_get_rate(clk);
 	clk_put(clk);
Signature · 7 lines
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
Live like a child, think like the god.
Acked-by on v1 1/1
#2 lore raw
In reply to Alexander Beregalov
Quoted 4 lines · Alexander Beregalov

Free pdata before exit.
Found by cppcheck.

Quoted 24 lines
---
 drivers/rtc/rtc-mxc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-mxc.c +4 -2
index 6bd5072..2642e6b 100644
@@ -396,8 +396,10 @@ 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)) {
+		ret = PTR_ERR(clk);
+		goto exit_free_pdata;
+	}
 
 	rate = clk_get_rate(clk);
 	clk_put(clk);
Signature · 1 line
1.6.6