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>
This commit is contained in:
Yuan Can 2022-11-25 09:38:32 +00:00 коммит произвёл Greg Kroah-Hartman
Родитель c54d485436
Коммит 3bec2f77f1
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -889,6 +889,8 @@ static int pic32_uart_probe(struct platform_device *pdev)
sport->irq_rx = irq_of_parse_and_map(np, 1);
sport->irq_tx = irq_of_parse_and_map(np, 2);
sport->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(sport->clk))
return PTR_ERR(sport->clk);
sport->dev = &pdev->dev;
/* Hardware flow control: gpios