Skip to content

Commit

Permalink
clk: imx: Add check for kcalloc
Browse files Browse the repository at this point in the history
As the potential failure of the kcalloc(),
it should be better to check it in order to
avoid the dereference of the NULL pointer.

Fixes: 379c9a2 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
Link: https://lore.kernel.org/r/20220310080257.1988412-1-jiasheng@iscas.ac.cn
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
  • Loading branch information
JiangJias authored and abelvesa committed Apr 12, 2022
1 parent ce0fc2f commit ed713e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/clk/imx/clk.c
Expand Up @@ -176,6 +176,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
int i;

imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
if (!imx_uart_clocks)
return;

if (!of_stdout)
return;
Expand Down

0 comments on commit ed713e2

Please sign in to comment.