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

serial: pic32: Add checks for devm_clk_get() in pic32_uart_probe()

As the devm_clk_get() may return ERR_PTR, its return value needs to be
checked to avoid invalid poineter dereference.

Signed-off-by: Yuan Can <yuancan@huawei.com>
Link: https://lore.kernel.org/r/20221125093832.33386-1-yuancan@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Yuan Can and committed by
Greg Kroah-Hartman
3bec2f77 c54d4854

+2
+2
drivers/tty/serial/pic32_uart.c
··· 889 889 sport->irq_rx = irq_of_parse_and_map(np, 1); 890 890 sport->irq_tx = irq_of_parse_and_map(np, 2); 891 891 sport->clk = devm_clk_get(&pdev->dev, NULL); 892 + if (IS_ERR(sport->clk)) 893 + return PTR_ERR(sport->clk); 892 894 sport->dev = &pdev->dev; 893 895 894 896 /* Hardware flow control: gpios