[PATCH v2] clk: mediatek: pllfh: Fix IO remapping leak in register_pllfhs error path
Brian Masney
bmasney at redhat.com
Thu Jul 9 07:28:04 PDT 2026
On Thu, Jul 09, 2026 at 02:23:00PM +0200, Louis-Alexis Eyraud wrote:
> When mtk_clk_register_pllfhs function fails to register a PLL, it
> unregisters all PLLs and cleans up itself in its error path before
> returning, so the function callers don't need to do it.
>
> But contrary to mtk_clk_unregister_pllfhs function, that does almost
> the same sequence, it does not free the IO memory mapped on fhctl node,
> leading to a leak.
>
> Fix this leak by factorizing the cleanup sequence in a new private
> function and use it both mtk_clk_register_pllfhs and
> mtk_clk_unregister_pllfhs functions.
>
> Also, change the loop index start value to avoid the -1 operation on
> index at each loop.
>
> Fixes: d7964de8a8ea ("clk: mediatek: Add new clock driver to handle FHCTL hardware")
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud at collabora.com>
Reviewed-by: Brian Masney <bmasney at redhat.com>
More information about the Linux-mediatek
mailing list