linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anson Huang <anson.huang@nxp.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"jslaby@suse.com" <jslaby@suse.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH] tty: serial: imx: Add return value check for platform_get_irq()
Date: Mon, 11 May 2020 07:34:02 +0000	[thread overview]
Message-ID: <AM6PR0402MB39112DC95B39E980E830BE34F5A10@AM6PR0402MB3911.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20200511072747.2vyavydpfa47kbuy@pengutronix.de>

Hi, Uwe


> Subject: Re: [PATCH] tty: serial: imx: Add return value check for
> platform_get_irq()
> 
> 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.

From the driver, the RX IRQ is always required, if it failed in platform_get_irq(), then the
rest of the code is NOT necessary to be executed, and also I am NOT sure if platform_get_irq()
failed, the devm_request_irq will always failed?

Not very understand about your last question, the platform_get_irq() already has error message printed
out, so no additional error message is needed in the check. If looking through all other drivers, most
of the platform_get_irq() are having the return value check, if it failed in platform_get_irq(), driver can
just return error from .probe().

Anson

      reply	other threads:[~2020-05-11  7:34 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
2020-05-11  7:34   ` Anson Huang [this message]

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=AM6PR0402MB39112DC95B39E980E830BE34F5A10@AM6PR0402MB3911.eurprd04.prod.outlook.com \
    --to=anson.huang@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-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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).