Commit 394a9e2c authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

TTY: serial, handle platform_get_irq retval properly

platform_get_irq can fail, so we should handle negative value when
returned.

[v2]

platform_get_irq can actually return zero on some platforms. So do not
remove checks for irq == 0 there.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: "Uwe Kleine-König" <kernel@pengutronix.de>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 934014d5
...@@ -2553,11 +2553,17 @@ static int sbsa_uart_probe(struct platform_device *pdev) ...@@ -2553,11 +2553,17 @@ static int sbsa_uart_probe(struct platform_device *pdev)
if (!uap) if (!uap)
return -ENOMEM; return -ENOMEM;
ret = platform_get_irq(pdev, 0);
if (ret < 0) {
dev_err(&pdev->dev, "cannot obtain irq\n");
return ret;
}
uap->port.irq = ret;
uap->reg_offset = vendor_sbsa.reg_offset; uap->reg_offset = vendor_sbsa.reg_offset;
uap->vendor = &vendor_sbsa; uap->vendor = &vendor_sbsa;
uap->fifosize = 32; uap->fifosize = 32;
uap->port.iotype = vendor_sbsa.access_32b ? UPIO_MEM32 : UPIO_MEM; uap->port.iotype = vendor_sbsa.access_32b ? UPIO_MEM32 : UPIO_MEM;
uap->port.irq = platform_get_irq(pdev, 0);
uap->port.ops = &sbsa_uart_pops; uap->port.ops = &sbsa_uart_pops;
uap->fixed_baud = baudrate; uap->fixed_baud = baudrate;
......
...@@ -1830,7 +1830,13 @@ static int lpuart_probe(struct platform_device *pdev) ...@@ -1830,7 +1830,13 @@ static int lpuart_probe(struct platform_device *pdev)
sport->port.dev = &pdev->dev; sport->port.dev = &pdev->dev;
sport->port.type = PORT_LPUART; sport->port.type = PORT_LPUART;
sport->port.iotype = UPIO_MEM; sport->port.iotype = UPIO_MEM;
sport->port.irq = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret < 0) {
dev_err(&pdev->dev, "cannot obtain irq\n");
return ret;
}
sport->port.irq = ret;
if (sport->lpuart32) if (sport->lpuart32)
sport->port.ops = &lpuart32_pops; sport->port.ops = &lpuart32_pops;
else else
......
...@@ -1720,7 +1720,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap) ...@@ -1720,7 +1720,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0); r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(uap->pdev, 0); irq = platform_get_irq(uap->pdev, 0);
if (!r_ports || !irq) if (!r_ports || irq <= 0)
return -ENODEV; return -ENODEV;
uap->port.mapbase = r_ports->start; uap->port.mapbase = r_ports->start;
......
...@@ -1317,7 +1317,12 @@ static int tegra_uart_probe(struct platform_device *pdev) ...@@ -1317,7 +1317,12 @@ static int tegra_uart_probe(struct platform_device *pdev)
} }
u->iotype = UPIO_MEM32; u->iotype = UPIO_MEM32;
u->irq = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret < 0) {
dev_err(&pdev->dev, "Couldn't get IRQ\n");
return ret;
}
u->irq = ret;
u->regshift = 2; u->regshift = 2;
ret = uart_add_one_port(&tegra_uart_driver, u); ret = uart_add_one_port(&tegra_uart_driver, u);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment