diff options
author | Yuan Can <yuancan@huawei.com> | 2022-11-25 12:38:32 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-19 18:02:23 +0300 |
commit | 3bec2f77f1029ac8549aa1f0223b46a987c49855 (patch) | |
tree | f7cdab041e283cad7cd93de915effe62ec465b38 /drivers/tty | |
parent | c54d48543689f821f6a5ade7e7fa828ada6a1195 (diff) | |
download | linux-3bec2f77f1029ac8549aa1f0223b46a987c49855.tar.xz |
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/pic32_uart.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c index ba3435263c1f..196a4e678451 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -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 |