* [PATCH] clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()'
@ 2018-05-13 11:17 Christophe JAILLET
2018-05-14 8:50 ` Gabriel FERNANDEZ
2018-05-15 20:37 ` [PATCH] " Stephen Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2018-05-13 11:17 UTC (permalink / raw)
To: linux-arm-kernel
We allocate some memory which is neither used, nor referenced by anything.
So axe it.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch as not been compile-tested, I don't have the corresponding arch
and have not taken time to cross-compile it.
---
drivers/clk/clk-stm32mp1.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c
index edd3cf451401..dfb9cb5bd0c4 100644
--- a/drivers/clk/clk-stm32mp1.c
+++ b/drivers/clk/clk-stm32mp1.c
@@ -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;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()'
2018-05-13 11:17 [PATCH] clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()' Christophe JAILLET
@ 2018-05-14 8:50 ` Gabriel FERNANDEZ
2018-05-15 20:37 ` [PATCH] " Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Gabriel FERNANDEZ @ 2018-05-14 8:50 UTC (permalink / raw)
To: linux-arm-kernel
Hi Christophe,
Many thanks !
Acked-by: Gabriel Fernandez <gabriel.fernandez@st.com>
On 05/13/2018 01:17 PM, Christophe Jaillet wrote:
> We allocate some memory which is neither used, nor referenced by anything.
> So axe it.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch as not been compile-tested, I don't have the corresponding arch
> and have not taken time to cross-compile it.
> ---
> drivers/clk/clk-stm32mp1.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c
> index edd3cf451401..dfb9cb5bd0c4 100644
> --- a/drivers/clk/clk-stm32mp1.c
> +++ b/drivers/clk/clk-stm32mp1.c
> @@ -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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()'
2018-05-13 11:17 [PATCH] clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()' Christophe JAILLET
2018-05-14 8:50 ` Gabriel FERNANDEZ
@ 2018-05-15 20:37 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2018-05-15 20:37 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Christophe JAILLET (2018-05-13 04:17:04)
> We allocate some memory which is neither used, nor referenced by anything.
> So axe it.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-15 20:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-13 11:17 [PATCH] clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()' Christophe JAILLET
2018-05-14 8:50 ` Gabriel FERNANDEZ
2018-05-15 20:37 ` [PATCH] " Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).