clk: Initialize struct clk_core kref earlier
authorStephen Boyd <sboyd@kernel.org>
Mon, 25 Mar 2024 18:41:57 +0000 (11:41 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Apr 2024 15:05:26 +0000 (17:05 +0200)
commitdb7c0ef4afeaae44312d0b8decdc8ec27e8eea7a
tree0ea78278e212c1ec51031bd91ca8d6175bcb33d7
parentbc6d766991e1456b54118b7391e4c13b22a616c1
clk: Initialize struct clk_core kref earlier

[ Upstream commit 9d05ae531c2cff20d5d527f04e28d28e04379929 ]

Initialize this kref once we allocate memory for the struct clk_core so
that we can reuse the release function to free any memory associated
with the structure. This mostly consolidates code, but also clarifies
that the kref lifetime exists once the container structure (struct
clk_core) is allocated instead of leaving it in a half-baked state for
most of __clk_core_init().

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240325184204.745706-4-sboyd@kernel.org
Stable-dep-of: e581cf5d2162 ("clk: Get runtime PM before walking tree during disable_unused")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/clk.c