diff options
author | Samuel Holland <samuel@sholland.org> | 2021-09-01 00:05:19 -0500 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2021-09-13 09:03:20 +0200 |
commit | 9bec2b9c6134052994115d2d3374e96f2ccb9b9d (patch) | |
tree | d88efc6c48a46634dc1f113c960169ec0e2e5275 /drivers/clk/sunxi-ng/ccu-sun8i-r40.c | |
parent | 4abfc297b6276310fcb28b14e2255265925cd581 (diff) | |
download | linux-9bec2b9c6134052994115d2d3374e96f2ccb9b9d.tar.gz |
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-sun8i-r40.c')
-rw-r--r-- | drivers/clk/sunxi-ng/ccu-sun8i-r40.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c index 84153418453f..002e0c3a04db 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c @@ -1346,7 +1346,7 @@ static int sun8i_r40_ccu_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun8i_r40_ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun8i_r40_ccu_desc); if (ret) return ret; |