Skip to content

Commit

Permalink
tty: serial: qcom_geni_serial: Drop useless check for dev.of_node
Browse files Browse the repository at this point in the history
With gcc 4.1.2:

    drivers/tty/serial/qcom_geni_serial.c: In function ‘qcom_geni_serial_probe’:
    drivers/tty/serial/qcom_geni_serial.c:1261: warning: ‘drv’ may be used uninitialized in this function

Indeed, if dev.of_node is NULL, drv will be used uninitialized, and
dereferenced in uart_add_one_port().  However, as this driver supports
DT only, dev.of_node will always be valid.

Hence remove the useless check for dev.of_node, killing the warning as a
side effect.

Fixes: 8a8a66a ("tty: serial: qcom_geni_serial: Add support for flow control")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Geert Uytterhoeven authored and Greg Kroah-Hartman committed Sep 18, 2018
1 parent 5963e8a commit 2843cbb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/tty/serial/qcom_geni_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,14 +1263,12 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart"))
console = true;

if (pdev->dev.of_node) {
if (console) {
drv = &qcom_geni_console_driver;
line = of_alias_get_id(pdev->dev.of_node, "serial");
} else {
drv = &qcom_geni_uart_driver;
line = of_alias_get_id(pdev->dev.of_node, "hsuart");
}
if (console) {
drv = &qcom_geni_console_driver;
line = of_alias_get_id(pdev->dev.of_node, "serial");
} else {
drv = &qcom_geni_uart_driver;
line = of_alias_get_id(pdev->dev.of_node, "hsuart");
}

port = get_port_from_line(line, console);
Expand Down

0 comments on commit 2843cbb

Please sign in to comment.