提交 b1e660c6 编写于 作者: A Aditya Pakki 提交者: Greg Kroah-Hartman

serial: mvebu-uart: Fix to avoid a potential NULL pointer dereference

commit 32f47179833b63de72427131169809065db6745e upstream.

of_match_device on failure to find a matching device can return a NULL
pointer. The patch checks for such a scenrio and passes the error upstream.
Signed-off-by: NAditya Pakki <pakki001@umn.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 f34ec64b
......@@ -799,6 +799,9 @@ static int mvebu_uart_probe(struct platform_device *pdev)
return -EINVAL;
}
if (!match)
return -ENODEV;
/* Assume that all UART ports have a DT alias or none has */
id = of_alias_get_id(pdev->dev.of_node, "serial");
if (!pdev->dev.of_node || id < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册