clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 13 May 2018 11:17:04 +0000 (13:17 +0200)
committerStephen Boyd <sboyd@kernel.org>
Tue, 15 May 2018 20:37:03 +0000 (13:37 -0700)
We allocate some memory which is neither used, nor referenced by anything.
So axe it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk-stm32mp1.c

index 35dabf1df39a3cd0b774dc28b554e9cdfa9aa3cb..e68cb478f21f75e5da3557747541a0e0d13f35b7 100644 (file)
@@ -579,14 +579,9 @@ clk_stm32_register_gate_ops(struct device *dev,
                            spinlock_t *lock)
 {
        struct clk_init_data init = { NULL };
-       struct clk_gate *gate;
        struct clk_hw *hw;
        int ret;
 
-       gate = kzalloc(sizeof(*gate), GFP_KERNEL);
-       if (!gate)
-               return ERR_PTR(-ENOMEM);
-
        init.name = name;
        init.parent_names = &parent_name;
        init.num_parents = 1;
@@ -604,10 +599,8 @@ clk_stm32_register_gate_ops(struct device *dev,
        hw->init = &init;
 
        ret = clk_hw_register(dev, hw);
-       if (ret) {
-               kfree(gate);
+       if (ret)
                hw = ERR_PTR(ret);
-       }
 
        return hw;
 }