Skip to contentSkip to conversation

Frees gate after if statement in clk-sunxi.c

PATCH In review Nick 5 participants 7 messages Jun 14, 2014 – Jun 16, 2014

Subsystems (3)
lore
Share & tools
lore

Nick

author
#0 lore raw

PATCH 1/1 Frees gate after if statement in clk-sunxi.c

---
 drivers/clk/sunxi/clk-sunxi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/sunxi/clk-sunxi.c +1 -0
index 4264834..6f4fc51 100644
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
 	u32 rate;
 
 	if (of_property_read_u32(node, "clock-frequency", &rate))
+		kree(gate);
 		return;
 
 	/* allocate fixed-rate and gate clock structs */
Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Nick
---
  drivers/clk/sunxi/clk-sunxi.c | 1 +
  1 file changed, 1 insertion(+)
drivers/clk/sunxi/clk-sunxi.c +0 -0
index 4264834..6f4fc51 100644

drivers/clk/sunxi/clk-sunxi.c static void __init sun4i_osc_clk_setup(struct device_node *node) · line 45

Quoted 4 lines
drivers/clk/sunxi/clk-sunxi.c +1 -0
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
  	u32 rate;
 
  	if (of_property_read_u32(node, "clock-frequency", &rate))
+		kree(gate);

'gate' is not allocated at this point either... at least not in Linus' tree.

drivers/clk/sunxi/clk-sunxi.c static void __init sun4i_osc_clk_setup(struct device_node *node) · line 46

Quoted 1 line
drivers/clk/sunxi/clk-sunxi.c +0 -0
  		return;

And you forgot {} around these 2 statements.

WBR, Sergei

#2 lore raw
In reply to Nick
Quoted 10 lines · Nick
---
  drivers/clk/sunxi/clk-sunxi.c | 1 +
  1 file changed, 1 insertion(+)
drivers/clk/sunxi/clk-sunxi.c +0 -0
index 4264834..6f4fc51 100644

drivers/clk/sunxi/clk-sunxi.c static void __init sun4i_osc_clk_setup(struct device_node *node) · line 46

Quoted 5 lines
drivers/clk/sunxi/clk-sunxi.c +1 -0
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
  	u32 rate;
 
  	if (of_property_read_u32(node, "clock-frequency", &rate))
+		kree(gate);
  		return;

There are no braces around this so the function of this code as written is an unconditional return and the return shouldn't be indented. I suspect, without reading the rest of the file, that that isn't what you intended.

drivers/clk/sunxi/clk-sunxi.c static void __init sun4i_osc_clk_setup(struct device_node *node) · line 48

Quoted 3 lines
drivers/clk/sunxi/clk-sunxi.c +0 -0
  	/* allocate fixed-rate and gate clock structs */
 

Adam

#3 lore raw
In reply to Nick
Quoted 1 line · Nick

This should be your full real name here.

drivers/clk/sunxi/clk-sunxi.c static void __init sun4i_osc_clk_setup(struct device_node *node) · line 45

Quoted 13 lines
---
 drivers/clk/sunxi/clk-sunxi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/sunxi/clk-sunxi.c +1 -0
index 4264834..6f4fc51 100644
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
 	u32 rate;
 
 	if (of_property_read_u32(node, "clock-frequency", &rate))
+		kree(gate);

There's a typo in kfree. How does that even compile?

Signature · 10 lines
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: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140615/ff1118cc/attachment.sig>
#4 lore raw

New Patch Just Fixed Typo for my email client.

---
 drivers/clk/sunxi/clk-sunxi.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

c b/drivers/clk/sunxi/clk-sunxi.c
index 4264834..6f4fc51 100644

drivers/clk/sunxi/clk-sunxi.c +0 -0
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct

device_node *node)

        u32 rate;

        if (of_property_read_u32(node, "clock-frequency", &rate))
+               kfree(gate);
                return;

        /* allocate fixed-rate and gate clock structs */

Cheers Nick

Quoted 25 lines · Maxime Ripard
Quoted 1 line · Nick

This should be your full real name here.

drivers/clk/sunxi/clk-sunxi.c static void __init sun4i_osc_clk_setup(struct device_node *node) · line 45

Quoted 13 lines
---
 drivers/clk/sunxi/clk-sunxi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/sunxi/clk-sunxi.c +1 -0
index 4264834..6f4fc51 100644
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
      u32 rate;
 
      if (of_property_read_u32(node, "clock-frequency", &rate))
+             kree(gate);

There's a typo in kfree. How does that even compile?

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

#5 lore raw

Seems the bug is fixed , don't worry about resent patch. Thanks Nick

Quoted 49 lines · Nick Krause

New Patch Just Fixed Typo for my email client.

---
 drivers/clk/sunxi/clk-sunxi.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

c b/drivers/clk/sunxi/clk-sunxi.c
index 4264834..6f4fc51 100644

drivers/clk/sunxi/clk-sunxi.c +1 -0
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct
 device_node *node)
        u32 rate;
 
        if (of_property_read_u32(node, "clock-frequency", &rate))
+               kfree(gate);
                return;
 
        /* allocate fixed-rate and gate clock structs */

Cheers Nick

Quoted 25 lines · Maxime Ripard
Quoted 1 line · Nick

This should be your full real name here.

drivers/clk/sunxi/clk-sunxi.c static void __init sun4i_osc_clk_setup(struct device_node *node) · line 45

Quoted 13 lines
---
 drivers/clk/sunxi/clk-sunxi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/sunxi/clk-sunxi.c +1 -0
index 4264834..6f4fc51 100644
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
      u32 rate;
 
      if (of_property_read_u32(node, "clock-frequency", &rate))
+             kree(gate);

There's a typo in kfree. How does that even compile?

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

#6 lore raw
Quoted 11 lines · Nick Krause

Seems the bug is fixed , don't worry about resent patch. Thanks Nick

Review static void __init sun4i_osc_clk_setup(struct · line 47

Quoted 7 lines · Nick Krause
(quoted diff) +1 -0
@@ -42,6 +42,7 @@ static void __init sun4i_osc_clk_setup(struct
 device_node *node)
        u32 rate;
 
        if (of_property_read_u32(node, "clock-frequency", &rate))
+               kfree(gate);
                return;

In any case, the kernel is not coded in Python.

C uses braces { } to enclose blocks of code, and does not care about indentation - indentation is meaningless to C. Python purely identifies blocks of code by indentation alone.

Please take account of the programming language when creating patches.

Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.