From 89d079dc17e8a32397de827cc85c1f4911b90424 Mon Sep 17 00:00:00 2001 From: Jerome Brunet Date: Tue, 24 Sep 2019 14:39:53 +0200 Subject: clk: let init callback return an error code If the init callback is allowed to request resources, it needs a return value to report the outcome of such a request. Signed-off-by: Jerome Brunet Link: https://lkml.kernel.org/r/20190924123954.31561-3-jbrunet@baylibre.com Reviewed-by: Andrew Lunn Acked-by: Heiko Stuebner Signed-off-by: Stephen Boyd --- drivers/clk/clk.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'drivers/clk/clk.c') diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 676e40deefcf..b8dc848a04f7 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3316,16 +3316,21 @@ static int __clk_core_init(struct clk_core *core) * optional platform-specific magic * * The .init callback is not used by any of the basic clock types, but - * exists for weird hardware that must perform initialization magic. - * Please consider other ways of solving initialization problems before - * using this callback, as its use is discouraged. + * exists for weird hardware that must perform initialization magic for + * CCF to get an accurate view of clock for any other callbacks. It may + * also be used needs to perform dynamic allocations. Such allocation + * must be freed in the terminate() callback. + * This callback shall not be used to initialize the parameters state, + * such as rate, parent, etc ... * * If it exist, this callback should called before any other callback of * the clock */ - if (core->ops->init) - core->ops->init(core->hw); - + if (core->ops->init) { + ret = core->ops->init(core->hw); + if (ret) + goto out; + } core->parent = __clk_init_parent(core); -- cgit v1.2.1