From: Jiasheng Jiang Date: Thu, 10 Mar 2022 08:02:57 +0000 (+0800) Subject: clk: imx: Add check for kcalloc X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ed713e2bc093239ccd380c2ce8ae9e4162f5c037;p=linux.git clk: imx: Add check for kcalloc 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: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout") Signed-off-by: Jiasheng Jiang Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220310080257.1988412-1-jiasheng@iscas.ac.cn Signed-off-by: Abel Vesa --- diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index 4bd6ad060eea5..5582f18dd632f 100644 --- a/drivers/clk/imx/clk.c +++ b/drivers/clk/imx/clk.c @@ -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;