aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@codeaurora.org>2018-04-06 20:49:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-23 04:22:30 -0400
commit066cd1c4e4b9b43116f2bf0f4a84ac7235e7abec (patch)
tree9af0cf1859485d85197b0bd2d7ea70bb909a4996 /drivers
parentdd709e72cb934eefd44de8d9969097173fbf45dc (diff)
tty: serial: qcom_geni_serial: Use signed variable to get IRQ
The platform_get_irq can return error. Assigning the return value to an unsigned variable and checking it for negative value will always return false. Use an intermediate signed variable to get IRQ information, check for any error and then assign it to 'irq' variable inside uart_port structure. Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/qcom_geni_serial.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 65ff669373d4..a1b3eb04cb32 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1022,6 +1022,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
1022 struct qcom_geni_serial_port *port; 1022 struct qcom_geni_serial_port *port;
1023 struct uart_port *uport; 1023 struct uart_port *uport;
1024 struct resource *res; 1024 struct resource *res;
1025 int irq;
1025 1026
1026 if (pdev->dev.of_node) 1027 if (pdev->dev.of_node)
1027 line = of_alias_get_id(pdev->dev.of_node, "serial"); 1028 line = of_alias_get_id(pdev->dev.of_node, "serial");
@@ -1061,11 +1062,12 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
1061 port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; 1062 port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS;
1062 port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; 1063 port->tx_fifo_width = DEF_FIFO_WIDTH_BITS;
1063 1064
1064 uport->irq = platform_get_irq(pdev, 0); 1065 irq = platform_get_irq(pdev, 0);
1065 if (uport->irq < 0) { 1066 if (irq < 0) {
1066 dev_err(&pdev->dev, "Failed to get IRQ %d\n", uport->irq); 1067 dev_err(&pdev->dev, "Failed to get IRQ %d\n", irq);
1067 return uport->irq; 1068 return irq;
1068 } 1069 }
1070 uport->irq = irq;
1069 1071
1070 uport->private_data = &qcom_geni_console_driver; 1072 uport->private_data = &qcom_geni_console_driver;
1071 platform_set_drvdata(pdev, port); 1073 platform_set_drvdata(pdev, port);