[PATCH v2 3/6] clk: mediatek: mt7622: fix memory leak on module removal
Brian Masney
bmasney at redhat.com
Tue Jul 7 07:47:44 PDT 2026
On Tue, Jul 07, 2026 at 04:48:32PM +0900, Akari Tsuyukusa wrote:
> clk-mt7622-apmixedsys.c and clk-mt7622-infracfg.c do not call
> platform_set_drvdata() during their driver probe callback,
> but their remove callback calls platform_get_drvdata().
> This results in platform_get_drvdata() returning NULL,
> which leads to calling kfree(NULL) in mtk_free_clk_data(NULL).
> This leaves clk_data unreleased, causing a memory leak.
>
> Fix this by calling platform_set_drvdata() during probe.
>
> Fixes: c50e2ea6507b ("clk: mediatek: mt7622-apmixedsys: Add .remove() callback for module build")
> Fixes: 838b86331c5e ("clk: mediatek: mt7622: Move infracfg to clk-mt7622-infracfg.c")
> Cc: stable at vger.kernel.org
> Signed-off-by: Akari Tsuyukusa <akkun11.open at gmail.com>
Reviewed-by: Brian Masney <bmasney at redhat.com>
More information about the linux-arm-kernel
mailing list