]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rtc: amlogic-a4: fix double free caused by devm
authorHaotian Zhang <vulab@iscas.ac.cn>
Tue, 21 Oct 2025 10:35:59 +0000 (18:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:33 +0000 (14:03 +0100)
commit2e1c79299036614ac32b251d145fad5391f4bcab
treec1c6004fed1978bef4e69e204234717d00729013
parentb18d3c3ce852372cd612901488436315aca6d02e
rtc: amlogic-a4: fix double free caused by devm

[ Upstream commit 384150d7a5b60c1086790a8ee07b0629f906cca2 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-amlogic-a4.c