summaryrefslogtreecommitdiff
path: root/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2021-09-01 08:05:19 +0300
committerMaxime Ripard <maxime@cerno.tech>2021-09-13 10:03:20 +0300
commit9bec2b9c6134052994115d2d3374e96f2ccb9b9d (patch)
treed88efc6c48a46634dc1f113c960169ec0e2e5275 /drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
parent4abfc297b6276310fcb28b14e2255265925cd581 (diff)
downloadlinux-9bec2b9c6134052994115d2d3374e96f2ccb9b9d.tar.xz
clk: sunxi-ng: Unregister clocks/resets when unbinding
Currently, unbinding a CCU driver unmaps the device's MMIO region, while leaving its clocks/resets and their providers registered. This can cause a page fault later when some clock operation tries to perform MMIO. Fix this by separating the CCU initialization from the memory allocation, and then using a devres callback to unregister the clocks and resets. This also fixes a memory leak of the `struct ccu_reset`, and uses the correct owner (the specific platform driver) for the clocks and resets. Early OF clock providers are never unregistered, and limited error handling is possible, so they are mostly unchanged. The error reporting is made more consistent by moving the message inside of_sunxi_ccu_probe. Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20210901050526.45673-2-samuel@sholland.org
Diffstat (limited to 'drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c')
-rw-r--r--drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c b/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
index 7ecc3a5a5b5e..61ad7ee91c11 100644
--- a/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
+++ b/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
@@ -538,7 +538,7 @@ static void __init suniv_f1c100s_ccu_setup(struct device_node *node)
val &= ~GENMASK(19, 16);
writel(val | (3 << 16), reg + SUNIV_PLL_AUDIO_REG);
- sunxi_ccu_probe(node, reg, &suniv_ccu_desc);
+ of_sunxi_ccu_probe(node, reg, &suniv_ccu_desc);
/* Gate then ungate PLL CPU after any rate changes */
ccu_pll_notifier_register(&suniv_pll_cpu_nb);