rtc: jz4740: Make sure clock provider gets removed
Subsystems (2)
PATCH 1/1 rtc: jz4740: Make sure clock provider gets removed
The jz4740 RTC driver registers a clock provider, but never removes it. This leaves a stale clock provider behind that references freed clocks when the device is unbound.
Use the managed devm_of_clk_add_hw_provider() instead of of_clk_add_hw_provider() to make sure the provider gets automatically removed on unbind.
--- drivers/rtc/rtc-jz4740.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/rtc/rtc-jz4740.c +2 -1
@@ -414,7 +414,8 @@ static int jz4740_rtc_probe(struct platform_device *pdev)return dev_err_probe (dev, ret,"Unable to register clk32k clock\n" ); - ret =of_clk_add_hw_provider (np, of_clk_hw_simple_get, &rtc->clk32k); + ret =devm_of_clk_add_hw_provider (dev, of_clk_hw_simple_get, + &rtc->clk32k);if (ret)return dev_err_probe (dev, ret,"Unable to register clk32k clock provider\n" );
Signature · 1 line
2.30.2
Quoted 9 lines · Lars-Peter Clausen
The jz4740 RTC driver registers a clock provider, but never removes it. This leaves a stale clock provider behind that references freed clocks when the device is unbound.
Use the managed
devm_of_clk_add_hw_provider()instead ofof_clk_add_hw_provider()to make sure the provider gets automatically removed on unbind.[...]
Applied, thanks!
[1/1] rtc: jz4740: Make sure clock provider gets removed
commit: 4fee39815aafd68ebc6a71b1b1b5d63f0ddde671
Best regards,
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com