Re: [PATCH v2 3/6] clk: mediatek: mt7622: fix memory leak on module removal
From: Brian Masney
Date: Tue Jul 07 2026 - 11:04:48 EST
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@xxxxxxxxxxxxxxx
> Signed-off-by: Akari Tsuyukusa <akkun11.open@xxxxxxxxx>
Reviewed-by: Brian Masney <bmasney@xxxxxxxxxx>