projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c54d485
)
serial: pic32: Add checks for devm_clk_get() in pic32_uart_probe()
author
Yuan Can
<yuancan@huawei.com>
Fri, 25 Nov 2022 09:38:32 +0000
(09:38 +0000)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 19 Jan 2023 15:02:23 +0000
(16:02 +0100)
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>
drivers/tty/serial/pic32_uart.c
patch
|
blob
|
history
diff --git
a/drivers/tty/serial/pic32_uart.c
b/drivers/tty/serial/pic32_uart.c
index ba3435263c1f77d6f672c54f7d3bd38bec09929f..196a4e67845102ede82ecee800d1f8204784e3b0 100644
(file)
--- 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