Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230104110032.1220721-2-peng.fan@oss.nxp.com

authored by

Peng Fan and committed by
Abel Vesa
f4419db4 1b929c02

+2 -1
+2 -1
drivers/clk/imx/clk.c
··· 205 205 clk_disable_unprepare(imx_uart_clocks[i]); 206 206 clk_put(imx_uart_clocks[i]); 207 207 } 208 - kfree(imx_uart_clocks); 209 208 } 209 + 210 + kfree(imx_uart_clocks); 210 211 211 212 return 0; 212 213 }