Commit 823b68ea authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Stephen Boyd
Browse files

clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()'



We allocate some memory which is neither used, nor referenced by anything.
So axe it.

Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarGabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 77dc0020
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -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;
}