Commit f4419db4 authored by Peng Fan's avatar Peng Fan Committed by Abel Vesa
Browse files

clk: imx: avoid memory leak



In case imx_register_uart_clocks return early, the imx_uart_clocks
memory will be no freed. So execute kfree always to avoid memory leak.

Fixes: 379c9a24 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
Reviewed-by: default avatarAbel Vesa <abel.vesa@linaro.org>
Signed-off-by: default avatarAbel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230104110032.1220721-2-peng.fan@oss.nxp.com
parent 1b929c02
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -205,9 +205,10 @@ static int __init imx_clk_disable_uart(void)
			clk_disable_unprepare(imx_uart_clocks[i]);
			clk_put(imx_uart_clocks[i]);
		}
		kfree(imx_uart_clocks);
	}

	kfree(imx_uart_clocks);

	return 0;
}
late_initcall_sync(imx_clk_disable_uart);