All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: sunxi: fix memory leaks
@ 2013-10-24 12:25 ` Valentin Ilie
  0 siblings, 0 replies; 4+ messages in thread
From: Valentin Ilie @ 2013-10-24 12:25 UTC (permalink / raw)
  To: linux-arm-kernel

When the if condition is true, "fixed" and "gate" should be free'd before return.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
---
 drivers/clk/sunxi/clk-sunxi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 34ee69f..a970b55 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -48,8 +48,11 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
 		return;
 	}
 
-	if (of_property_read_u32(node, "clock-frequency", &rate))
+	if (of_property_read_u32(node, "clock-frequency", &rate)) {
+		kfree(fixed);
+		kfree(gate);
 		return;
+	}
 
 	/* set up gate and fixed rate properties */
 	gate->reg = of_iomap(node, 0);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] clk: sunxi: fix memory leaks
@ 2013-10-24 12:25 ` Valentin Ilie
  0 siblings, 0 replies; 4+ messages in thread
From: Valentin Ilie @ 2013-10-24 12:25 UTC (permalink / raw)
  To: mturquette, emilio, maxime.ripard, gregory.clement, sboyd
  Cc: linux-arm-kernel, linux-kernel, Valentin Ilie

When the if condition is true, "fixed" and "gate" should be free'd before return.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
---
 drivers/clk/sunxi/clk-sunxi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 34ee69f..a970b55 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -48,8 +48,11 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
 		return;
 	}
 
-	if (of_property_read_u32(node, "clock-frequency", &rate))
+	if (of_property_read_u32(node, "clock-frequency", &rate)) {
+		kfree(fixed);
+		kfree(gate);
 		return;
+	}
 
 	/* set up gate and fixed rate properties */
 	gate->reg = of_iomap(node, 0);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] clk: sunxi: fix memory leaks
  2013-10-24 12:25 ` Valentin Ilie
@ 2013-10-24 15:52   ` Maxime Ripard
  -1 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2013-10-24 15:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, Oct 24, 2013 at 03:25:13PM +0300, Valentin Ilie wrote:
> When the if condition is true, "fixed" and "gate" should be free'd before return.
> 
> Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>

A patch has already been submitted for this.

https://lkml.org/lkml/2013/10/18/524

Thanks anyway!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131024/f86e9e0d/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: sunxi: fix memory leaks
@ 2013-10-24 15:52   ` Maxime Ripard
  0 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2013-10-24 15:52 UTC (permalink / raw)
  To: Valentin Ilie
  Cc: mturquette, emilio, gregory.clement, sboyd, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

Hi,

On Thu, Oct 24, 2013 at 03:25:13PM +0300, Valentin Ilie wrote:
> When the if condition is true, "fixed" and "gate" should be free'd before return.
> 
> Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>

A patch has already been submitted for this.

https://lkml.org/lkml/2013/10/18/524

Thanks anyway!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-24 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-24 12:25 [PATCH] clk: sunxi: fix memory leaks Valentin Ilie
2013-10-24 12:25 ` Valentin Ilie
2013-10-24 15:52 ` Maxime Ripard
2013-10-24 15:52   ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.