diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-12-28 19:23:06 +0900 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2016-02-02 11:53:13 -0800 |
commit | 858d5881564026cbc4e6f5e25ae878a27df5d4c9 (patch) | |
tree | 774eb9265a4066ce1a81da595ecd25c4657087b2 /lib/raid6 | |
parent | 5146e0b05963f75347c9f4e18996da245f859e32 (diff) | |
download | linux-858d5881564026cbc4e6f5e25ae878a27df5d4c9.tar.bz2 |
clk: avoid circular clock topology
Currently, clk_register() never checks a circular parent looping,
but clock providers could register such an insane clock topology.
For example, "clk_a" could have "clk_b" as a parent, and vice versa.
In this case, clk_core_reparent() creates a circular parent list
and __clk_recalc_accuracies() calls itself recursively forever.
The core infrastructure should be kind enough to bail out, showing
an appropriate error message in such a case. This helps to easily
find a bug in clock providers. (uh, I made such a silly mistake
when I was implementing my clock providers first. I was upset
because the kernel did not respond, without any error message.)
This commit adds a new helper function, __clk_is_ancestor(). It
returns true if the second argument is a possible ancestor of the
first one. If a clock core is a possible ancestor of itself, it
would make a loop when it were registered. That should be detected
as an error.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'lib/raid6')
0 files changed, 0 insertions, 0 deletions