linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: gregkh@linuxfoundation.org, jslaby@suse.com, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Linux-imx@nxp.com
Subject: Re: [PATCH] tty: serial: imx: Add return value check for platform_get_irq()
Date: Mon, 11 May 2020 09:27:47 +0200	[thread overview]
Message-ID: <20200511072747.2vyavydpfa47kbuy@pengutronix.de> (raw)
In-Reply-To: <1589180996-618-1-git-send-email-Anson.Huang@nxp.com>

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 <Anson.Huang@nxp.com>
> ---
>  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/ |

  reply	other threads:[~2020-05-11  7:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11  7:09 [PATCH] tty: serial: imx: Add return value check for platform_get_irq() Anson Huang
2020-05-11  7:27 ` Uwe Kleine-König [this message]
2020-05-11  7:34   ` Anson Huang

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=20200511072747.2vyavydpfa47kbuy@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=Anson.Huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).