Masahiro Yamada 176d11690b clk: move core->parents allocation to clk_register()
Currently, __clk_core_init() allows failure of the kcalloc() for the
core->parents.  So, clk_fetch_parent_index() and __clk_init_parent()
also try to allocate core->parents in case it has not been allocated
yet.  Scattering memory allocation here and there makes things
complicated.

Like other clk_core members, allocate core->parents in clk_register()
and let it fail in case of memory shortage.  If we cannot allocate
such a small piece of memory, the system is already insane.  There is
no point to postpone the memory allocation.

Also, allocate core->parents regardless of core->num_parents.  We want
it even if core->num_parents == 1 because clk_fetch_parent_index()
might be called against the clk_core with a single parent.

If core->num_parents == 0, core->parents is set to ZERO_SIZE_PTR. It
is harmless because no access happens to core->parents in such a case.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2016-02-01 17:01:46 -08:00
..
2016-01-29 16:31:40 -08:00
2015-11-10 15:00:03 -08:00
2015-09-17 11:15:14 -07:00
2015-07-20 11:11:36 -07:00
2015-12-01 21:44:22 +01:00
2015-12-23 23:23:18 -08:00
2016-01-20 17:30:20 -08:00
2015-09-01 12:18:40 -07:00
2015-07-20 11:11:32 -07:00
2015-05-21 11:55:05 -07:00
2015-07-20 11:11:22 -07:00
2015-07-20 11:11:33 -07:00
2015-04-10 14:44:43 -07:00
2015-11-30 13:00:54 -08:00
2015-07-20 10:53:00 -07:00
2015-07-20 11:11:35 -07:00
2015-11-20 10:40:37 -08:00
2015-07-20 10:53:04 -07:00
2015-07-20 10:53:05 -07:00