Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rtc: amlogic-a4: fix double free caused by devm

The clock obtained via devm_clk_get_enabled() is automatically managed
by devres and will be disabled and freed on driver detach. Manually
calling clk_disable_unprepare() in error path and remove function
causes double free.

Remove the redundant clk_disable_unprepare() calls from the probe
error path and aml_rtc_remove(), allowing the devm framework to
automatically manage the clock lifecycle.

Fixes: c89ac9182ee2 ("rtc: support for the Amlogic on-chip RTC")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
Link: https://patch.msgid.link/20251021103559.1903-1-vulab@iscas.ac.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Haotian Zhang and committed by
Alexandre Belloni
384150d7 3a866087

-4
-4
drivers/rtc/rtc-amlogic-a4.c
··· 390 390 391 391 return 0; 392 392 err_clk: 393 - clk_disable_unprepare(rtc->sys_clk); 394 393 device_init_wakeup(dev, false); 395 394 396 395 return ret; ··· 422 423 423 424 static void aml_rtc_remove(struct platform_device *pdev) 424 425 { 425 - struct aml_rtc_data *rtc = dev_get_drvdata(&pdev->dev); 426 - 427 - clk_disable_unprepare(rtc->sys_clk); 428 426 device_init_wakeup(&pdev->dev, false); 429 427 } 430 428