clk: Initialize struct clk_core kref earlier
authorStephen Boyd <sboyd@kernel.org>
Mon, 25 Mar 2024 18:41:57 +0000 (11:41 -0700)
committerStephen Boyd <sboyd@kernel.org>
Mon, 8 Apr 2024 02:29:51 +0000 (19:29 -0700)
commit9d05ae531c2cff20d5d527f04e28d28e04379929
tree8392ea057b3a82bbf5c099186ddaf8b7c1c4e8c4
parent6f63af7511e7058f3fa4ad5b8102210741c9f947
clk: Initialize struct clk_core kref earlier

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
drivers/clk/clk.c