[PATCH] soc: xilinx: vcu: modify the order of devices unregistration

From: Ваторопин Андрей
Date: Mon Mar 24 2025 - 02:16:47 EST


From: Andrey Vatoropin <a.vatoropin@xxxxxxx>

The order of registration of 'struct clk_hw' handles in
xvcu_clk_hw_register_leaf() does not correspond the order of
unregistration performed in xvcu_clk_hw_unregister_leaf().

Clean up the order and replace the duplicate !divider check with a more
appropriate one.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Vatoropin <a.vatoropin@xxxxxxx>
---
drivers/clk/xilinx/xlnx_vcu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/xilinx/xlnx_vcu.c b/drivers/clk/xilinx/xlnx_vcu.c
index 81501b48412e..e4b08f501958 100644
--- a/drivers/clk/xilinx/xlnx_vcu.c
+++ b/drivers/clk/xilinx/xlnx_vcu.c
@@ -511,11 +511,11 @@ static void xvcu_clk_hw_unregister_leaf(struct clk_hw *hw)
return;

mux = clk_hw_get_parent(divider);
- clk_hw_unregister_mux(mux);
- if (!divider)
+ clk_hw_unregister_divider(divider);
+ if (!mux)
return;

- clk_hw_unregister_divider(divider);
+ clk_hw_unregister_mux(mux);
}

static int xvcu_register_clock_provider(struct xvcu_device *xvcu)
--
2.43.0