From: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx> commit 12fd64babaca4dc09d072f63eda76ba44119816a upstream. There is a clk == NULL check after the switch to check for unsupported clk types. Since clk is re-assigned in a loop, this check is useless right now for anything but the first round. Let's fix this up by assigning clk = NULL in the loop before the switch statement. Fixes: a245fecbb806 ("clk: rockchip: add basic infrastructure for clock branches") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx> [added fixes + stable-cc] Link: https://lore.kernel.org/r/20240325193609.237182-6-sebastian.reichel@xxxxxxxxxxxxx Signed-off-by: Heiko Stuebner <heiko@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/clk/rockchip/clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c @@ -444,12 +444,13 @@ void __init rockchip_clk_register_branch struct rockchip_clk_branch *list, unsigned int nr_clk) { - struct clk *clk = NULL; + struct clk *clk; unsigned int idx; unsigned long flags; for (idx = 0; idx < nr_clk; idx++, list++) { flags = list->flags; + clk = NULL; /* catch simple muxes */ switch (list->branch_type) { Patches currently in stable-queue which might be from sebastian.reichel@xxxxxxxxxxxxx are queue-4.19/clk-rockchip-fix-error-for-unknown-clocks.patch queue-4.19/power-supply-max17042_battery-fix-soc-threshold-calc.patch queue-4.19/power-reset-brcmstb-do-not-go-into-infinite-loop-if-.patch