clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered
Subsystems (2)
Stephen Boyd
maintainerPATCH 1/1 clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered
The implementation of clk_hw_get_name() relies on the clk_core associated with the clk_hw pointer existing. If of_clk_hw_register() fails, there isn't a clk_core created yet, so calling clk_hw_get_name() here fails. Extract the name first so we can print it later.
--- drivers/clk/sunxi-ng/ccu_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/sunxi-ng/ccu_common.c +3 -2
@@ -97,14 +97,15 @@ int sunxi_ccu_probe(struct device_node *node, void __iomem *reg,for (i =0 ; i < desc->hw_clks->num ; i++) {struct clk_hw *hw = desc->hw_clks->hws[i]; +const char *name;if (!hw)continue ; + name = hw->init->name; ret =of_clk_hw_register (node, hw);if (ret) { -pr_err ("Couldn't register clock %d - %s\n" , - i,clk_hw_get_name (hw)); +pr_err ("Couldn't register clock %d - %s\n" , i, name); goto err_clk_unreg; } }
base-commit: 5f9e832c137075045d15cd6899ab0505cfb2ca4b
Signature · 1 line
Sent by a computer through tubes
Quoted 9 lines · Stephen Boyd
The implementation of
clk_hw_get_name()relies on theclk_coreassociated with theclk_hwpointer existing. Ifof_clk_hw_register()fails, there isn't aclk_corecreated yet, so callingclk_hw_get_name()here fails. Extract the name first so we can print it later.Fixes 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Do you want to apply it yourself, or should I merge this and send you a PR later?
Thanks!
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Stephen Boyd
maintainerQuoting Maxime Ripard (2019-08-15 01:01:46)
Quoted 11 lines · Stephen Boyd
Quoted 9 lines
The implementation of
clk_hw_get_name()relies on theclk_coreassociated with theclk_hwpointer existing. Ifof_clk_hw_register()fails, there isn't aclk_corecreated yet, so callingclk_hw_get_name()here fails. Extract the name first so we can print it later.Fixes 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Quoted 5 lines
Acked-by Maxime Ripard <[email protected]>Do you want to apply it yourself, or should I merge this and send you a PR later?
I can apply it myself. Thanks! Now to figure out the real problem...
Quoting Stephen Boyd (2019-08-14 21:10:37)
Quoted 10 lines
The implementation of
clk_hw_get_name()relies on theclk_coreassociated with theclk_hwpointer existing. Ifof_clk_hw_register()fails, there isn't aclk_corecreated yet, so callingclk_hw_get_name()here fails. Extract the name first so we can print it later.Fixes 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next