[PATCH 5.3 038/166] clk: sunxi: Dont call clk_hw_get_name() on a hw that isnt registered
From: Greg Kroah-Hartman
Date: Sun Oct 06 2019 - 13:50:01 EST
From: Stephen Boyd <sboyd@xxxxxxxxxx>
[ Upstream commit a7b85ad25a97cf897b4819a121655c483d86156f ]
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.
Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
Cc: Maxime Ripard <maxime.ripard@xxxxxxxxxxx>
Cc: Chen-Yu Tsai <wens@xxxxxxxx>
Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/clk/sunxi-ng/ccu_common.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c
index 7fe3ac980e5f9..2e20e650b6c01 100644
--- a/drivers/clk/sunxi-ng/ccu_common.c
+++ b/drivers/clk/sunxi-ng/ccu_common.c
@@ -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;
}
}
--
2.20.1