]> git.itanic.dy.fi Git - linux-stable/commit
clk: hisilicon: hi3559a: Fix an erroneous devm_kfree()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 21 Jan 2024 15:16:24 +0000 (16:16 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:17:09 +0000 (18:17 -0400)
commitd575765b1b62e8bdb00af11caa1aabeb01763d9f
treeda593c333d0b1e6ceb87788a6f55bea43cba6efb
parentb3e3fb27525e2b94cfa494557bddab5d692b8813
clk: hisilicon: hi3559a: Fix an erroneous devm_kfree()

[ Upstream commit 64c6a38136b74a2f18c42199830975edd9fbc379 ]

'p_clk' is an array allocated just before the for loop for all clk that
need to be registered.
It is incremented at each loop iteration.

If a clk_register() call fails, 'p_clk' may point to something different
from what should be freed.

The best we can do, is to avoid this wrong release of memory.

Fixes: 6c81966107dc ("clk: hisilicon: Add clock driver for hi3559A SoC")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/773fc8425c3b8f5b0ca7c1d89f15b65831a85ca9.1705850155.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/hisilicon/clk-hi3559a.c