aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/sunxi-ng/ccu-sun50i-a100.c
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2021-09-01 00:05:19 -0500
committerMaxime Ripard <maxime@cerno.tech>2021-09-13 09:03:20 +0200
commit9bec2b9c6134052994115d2d3374e96f2ccb9b9d (patch)
treed88efc6c48a46634dc1f113c960169ec0e2e5275 /drivers/clk/sunxi-ng/ccu-sun50i-a100.c
parentclk: sunxi-ng: Add machine dependency to A83T CCU (diff)
downloadlinux-dev-9bec2b9c6134052994115d2d3374e96f2ccb9b9d.tar.xz
linux-dev-9bec2b9c6134052994115d2d3374e96f2ccb9b9d.zip
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-sun50i-a100.c')
-rw-r--r--drivers/clk/sunxi-ng/ccu-sun50i-a100.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c b/drivers/clk/sunxi-ng/ccu-sun50i-a100.c
index 81b48c73d389..913bb08e6dee 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a100.c
@@ -1247,7 +1247,7 @@ static int sun50i_a100_ccu_probe(struct platform_device *pdev)
writel(val, reg + sun50i_a100_usb2_clk_regs[i]);
}
- ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a100_ccu_desc);
+ ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a100_ccu_desc);
if (ret)
return ret;