All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	liviu.dudau@arm.com, sudeep.holla@arm.com,
	lorenzo.pieralisi@arm.com
Cc: linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: [PATCH] serial: mps2-uart: Check for error irq
Date: Wed, 22 Dec 2021 11:36:04 +0800	[thread overview]
Message-ID: <20211222033604.1049339-1-jiasheng@iscas.ac.cn> (raw)

I find that platform_get_irq() will not always succeed.
It will return error irq in case there is no suitable irq.
Therefore, it might be better to check it if order to avoid the use of
error irq.

Fixes: 041f031def33 ("serial: mps2-uart: add MPS2 UART driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/tty/serial/mps2-uart.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c
index 587b42f754cb..117d9896051f 100644
--- a/drivers/tty/serial/mps2-uart.c
+++ b/drivers/tty/serial/mps2-uart.c
@@ -585,10 +585,20 @@ static int mps2_init_port(struct platform_device *pdev,
 
 	if (mps_port->flags & UART_PORT_COMBINED_IRQ) {
 		mps_port->port.irq = platform_get_irq(pdev, 0);
+		if (mps_port->port.irq < 0)
+			return mps_port->port.irq;
 	} else {
 		mps_port->rx_irq = platform_get_irq(pdev, 0);
+		if (mps_port->rx_irq < 0)
+			return mps_port->rx_irq;
+
 		mps_port->tx_irq = platform_get_irq(pdev, 1);
+		if (mps_port->tx_irq < 0)
+			return mps_port->tx_irq;
+
 		mps_port->port.irq = platform_get_irq(pdev, 2);
+		if (mps_port->port.irq < 0)
+			return mps_port->port.irq;
 	}
 
 	return ret;
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	liviu.dudau@arm.com, sudeep.holla@arm.com,
	lorenzo.pieralisi@arm.com
Cc: linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: [PATCH] serial: mps2-uart: Check for error irq
Date: Wed, 22 Dec 2021 11:36:04 +0800	[thread overview]
Message-ID: <20211222033604.1049339-1-jiasheng@iscas.ac.cn> (raw)

I find that platform_get_irq() will not always succeed.
It will return error irq in case there is no suitable irq.
Therefore, it might be better to check it if order to avoid the use of
error irq.

Fixes: 041f031def33 ("serial: mps2-uart: add MPS2 UART driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/tty/serial/mps2-uart.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c
index 587b42f754cb..117d9896051f 100644
--- a/drivers/tty/serial/mps2-uart.c
+++ b/drivers/tty/serial/mps2-uart.c
@@ -585,10 +585,20 @@ static int mps2_init_port(struct platform_device *pdev,
 
 	if (mps_port->flags & UART_PORT_COMBINED_IRQ) {
 		mps_port->port.irq = platform_get_irq(pdev, 0);
+		if (mps_port->port.irq < 0)
+			return mps_port->port.irq;
 	} else {
 		mps_port->rx_irq = platform_get_irq(pdev, 0);
+		if (mps_port->rx_irq < 0)
+			return mps_port->rx_irq;
+
 		mps_port->tx_irq = platform_get_irq(pdev, 1);
+		if (mps_port->tx_irq < 0)
+			return mps_port->tx_irq;
+
 		mps_port->port.irq = platform_get_irq(pdev, 2);
+		if (mps_port->port.irq < 0)
+			return mps_port->port.irq;
 	}
 
 	return ret;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2021-12-22  3:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22  3:36 Jiasheng Jiang [this message]
2021-12-22  3:36 ` [PATCH] serial: mps2-uart: Check for error irq Jiasheng Jiang
2021-12-22 10:23 ` Vladimir Murzin
2021-12-22 10:23   ` Vladimir Murzin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211222033604.1049339-1-jiasheng@iscas.ac.cn \
    --to=jiasheng@iscas.ac.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.