1
0
Fork 0

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.

Fixes: 1d80c14248 ("clk: sunxi-ng: Add common infrastructure")
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
alistair/sunxi64-5.4-dsi
Stephen Boyd 2019-08-14 21:10:37 -07:00
parent e0e04fc866
commit a7b85ad25a
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}
}