WSL2-Linux-Kernel/drivers/clk
Masahiro Yamada 858d588156 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>
2016-02-02 11:53:13 -08:00
..
at91 clk: at91: Revert "keep slow clk enabled to prevent system hang" 2015-11-20 10:53:12 -08:00
bcm clk: iproc: Remove __init from header 2016-01-29 16:31:40 -08:00
berlin
h8300
hisilicon
imx clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
ingenic
keystone
mediatek clk: mediatek: Fix memory leak on clock init fail 2016-01-29 13:02:51 -08:00
meson
mmp clk: mmp: stop using platform headers 2015-12-01 21:44:22 +01:00
mvebu clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
mxs clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
nxp clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
pistachio
pxa ARM: pxa: make more mach/*.h files local 2015-12-01 21:52:50 +01:00
qcom clk:gcc-msm8916: add missing mss_q6_bimc_axi clock 2016-01-29 16:35:22 -08:00
rockchip Merge branch 'clk-fixes' into clk-next 2016-01-29 17:26:31 -08:00
samsung clk: Move vendor's Kconfig into CCF menu section 2016-01-29 16:30:06 -08:00
shmobile Merge branch 'clk-renesas' into clk-next 2015-12-31 15:17:39 -08:00
sirf
socfpga
spear
st clk: st: avoid uninitialized variable use 2016-01-29 17:20:08 -08:00
sunxi Allwinner clocks changes for 4.5 2015-12-23 23:23:18 -08:00
tegra asm-generic changes for 4.5 2016-01-20 17:30:20 -08:00
ti clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
ux500
versatile ARM: SoC multiplatform code changes for v4.5 2016-01-20 18:03:56 -08:00
x86
zte
zynq
Kconfig clk: Move vendor's Kconfig into CCF menu section 2016-01-29 16:30:06 -08:00
Makefile clk: tango4: rename ARCH_TANGOX to ARCH_TANGO 2016-01-29 12:08:02 -08:00
clk-asm9260.c
clk-axi-clkgen.c clk: axi-clkgen: Remove sometimes impossible check 2016-01-29 17:11:02 -08:00
clk-axm5516.c
clk-cdce706.c
clk-cdce925.c
clk-clps711x.c
clk-composite.c clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
clk-conf.c
clk-cs2000-cp.c clk: add CS2000 Fractional-N driver 2015-11-30 16:33:38 -08:00
clk-devres.c
clk-divider.c clk: optimize the divider walk in clk_divider_bestdiv() 2016-01-29 16:45:32 -08:00
clk-efm32gg.c
clk-fixed-factor.c clk: add clk_unregister_fixed_factor() 2016-01-29 16:35:49 -08:00
clk-fixed-rate.c clk: add clk_unregister_fixed_rate() 2016-01-29 16:37:24 -08:00
clk-fractional-divider.c clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
clk-gate.c clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
clk-gpio.c clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
clk-highbank.c
clk-ls1x.c
clk-max-gen.c
clk-max-gen.h
clk-max77686.c
clk-max77802.c
clk-mb86s7x.c
clk-moxart.c
clk-multiplier.c clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
clk-mux.c clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
clk-nomadik.c
clk-nspire.c
clk-palmas.c clk: palmas: fix a possible NULL dereference 2016-01-29 16:57:09 -08:00
clk-pwm.c
clk-qoriq.c clk: qoriq: fix memory leak 2015-11-30 13:00:54 -08:00
clk-rk808.c
clk-s2mps11.c clk: s2mps11: remove redundant code 2016-01-29 12:47:22 -08:00
clk-scpi.c clk: scpi: Fix checking return value of platform_device_register_simple() 2016-01-29 12:07:59 -08:00
clk-si514.c
clk-si570.c
clk-si5351.c clk: si5351: Add PLL soft reset 2015-11-20 10:40:37 -08:00
clk-si5351.h
clk-stm32f4.c
clk-tango4.c clk: tango4: clkgen driver for Tango4 platforms 2015-11-16 11:07:06 -08:00
clk-twl6040.c
clk-u300.c
clk-vt8500.c clk: vt8500: fix sign of possible PLL values 2016-01-29 16:43:58 -08:00
clk-wm831x.c
clk-xgene.c clk: xgene: Remove return from void function 2016-01-29 12:57:54 -08:00
clk.c clk: avoid circular clock topology 2016-02-02 11:53:13 -08:00
clk.h
clkdev.c