Re: [PATCH] tty: serial: imx: Add return value check for platform_get_irq()
From: Uwe Kleine-König <hidden>
Date: 2020-05-11 07:27:59
Also in:
linux-serial, lkml
From: Uwe Kleine-König <hidden>
Date: 2020-05-11 07:27:59
Also in:
linux-serial, lkml
Hello Anson, On Mon, May 11, 2020 at 03:09:56PM +0800, Anson Huang wrote:
RX irq is required, so add return value check for platform_get_irq(). Signed-off-by: Anson Huang <redacted> --- drivers/tty/serial/imx.c | 2 ++ 1 file changed, 2 insertions(+)diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index f4d6810..f4023d9 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c@@ -2252,6 +2252,8 @@ static int imx_uart_probe(struct platform_device *pdev) return PTR_ERR(base); rxirq = platform_get_irq(pdev, 0); + if (rxirq < 0) + return rxirq; txirq = platform_get_irq_optional(pdev, 1); rtsirq = platform_get_irq_optional(pdev, 2);
I'm not sure we need such a check as devm_request_irq fails if the return value of platform_get_irq() is bogus. But if we decide this construct is good enough, the error reporting needs some love as currently it emits two error messages which is confusing. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel