clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 23 Apr 2021 07:02:26 +0000 (09:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:46 +0000 (19:16 +0100)
commit8525028b4652cf1afc0b85d9f93390eea684c01b
tree5935829e17a92e1e09ffb817a58fde40db8eefeb
parent532c48310396fbe769c4facdb9163dc539522b05
clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths

[ Upstream commit af9617b419f77cf0b99702a7b2b0519da0d27715 ]

If we exit the for_each_of_cpu_node loop early, the reference on the
current node must be decremented, otherwise there is a leak.

Fixes: f756e362d938 ("clk: mvebu: add CPU clock driver for Armada 7K/8K")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/545df946044fc1fc05a4217cdf0054be7a79e49e.1619161112.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/mvebu/ap-cpu-clk.c