public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers/clk/keystone: avoid a memory leak
@ 2022-07-22  4:13 Yuanjun Gong
  2022-07-23  1:53 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuanjun Gong @ 2022-07-22  4:13 UTC (permalink / raw)
  To: Yuanjun Gong, Santosh Shilimkar, linux-kernel

In ti_syscon_gate_clk_register, priv is allocated by devm_kzalloc.
On the error path, it should be freed before return.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 drivers/clk/keystone/syscon-clk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/keystone/syscon-clk.c b/drivers/clk/keystone/syscon-clk.c
index 19198325b909..d8919bdafe34 100644
--- a/drivers/clk/keystone/syscon-clk.c
+++ b/drivers/clk/keystone/syscon-clk.c
@@ -84,6 +84,7 @@ static struct clk_hw
 
 	ret = devm_clk_hw_register(dev, &priv->hw);
 	if (ret)
+		devm_kfree(dev, priv);
 		return ERR_PTR(ret);
 
 	return &priv->hw;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-24 15:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-22  4:13 [PATCH 1/1] drivers/clk/keystone: avoid a memory leak Yuanjun Gong
2022-07-23  1:53 ` kernel test robot
2022-07-24  3:26 ` kernel test robot
2022-07-24 15:08 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox