diff mbox series

clk: npcm7xx: Fix incorrect kfree

Message ID 20230923133127.1815621-1-j.neuschaefer@gmx.net (mailing list archive)
State Accepted, archived
Headers show
Series clk: npcm7xx: Fix incorrect kfree | expand

Commit Message

J. Neuschäfer Sept. 23, 2023, 1:31 p.m. UTC
The corresponding allocation is:

> npcm7xx_clk_data = kzalloc(struct_size(npcm7xx_clk_data, hws,
> 			     NPCM7XX_NUM_CLOCKS), GFP_KERNEL);

... so, kfree should be applied to npcm7xx_clk_data, not
npcm7xx_clk_data->hws.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 drivers/clk/clk-npcm7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.40.1

Comments

Stephen Boyd Oct. 19, 2023, 1:06 a.m. UTC | #1
Quoting Jonathan Neuschäfer (2023-09-23 06:31:27)
> The corresponding allocation is:
> 
> > npcm7xx_clk_data = kzalloc(struct_size(npcm7xx_clk_data, hws,
> >                            NPCM7XX_NUM_CLOCKS), GFP_KERNEL);
> 
> ... so, kfree should be applied to npcm7xx_clk_data, not
> npcm7xx_clk_data->hws.
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/clk-npcm7xx.c b/drivers/clk/clk-npcm7xx.c
index e319cfa51a8a3..030186def9c69 100644
--- a/drivers/clk/clk-npcm7xx.c
+++ b/drivers/clk/clk-npcm7xx.c
@@ -510,7 +510,7 @@  static void __init npcm7xx_clk_init(struct device_node *clk_np)
 	return;

 npcm7xx_init_fail:
-	kfree(npcm7xx_clk_data->hws);
+	kfree(npcm7xx_clk_data);
 npcm7xx_init_np_err:
 	iounmap(clk_base);
 npcm7xx_init_error: