aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2019-09-24 14:39:53 +0200
committerStephen Boyd <sboyd@kernel.org>2019-12-23 18:53:13 -0800
commit89d079dc17e8a32397de827cc85c1f4911b90424 (patch)
tree13bd00045568d89041edc78c77ebd5d4c027e3e7 /drivers/clk/clk.c
parentclk: actually call the clock init before any other callback of the clock (diff)
downloadwireguard-linux-89d079dc17e8a32397de827cc85c1f4911b90424.tar.xz
wireguard-linux-89d079dc17e8a32397de827cc85c1f4911b90424.zip
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 <jbrunet@baylibre.com> Link: https://lkml.kernel.org/r/20190924123954.31561-3-jbrunet@baylibre.com Reviewed-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c17
1 files changed, 11 insertions, 6 deletions
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);