linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dejin Zheng <zhengdejin5@gmail.com>
To: Michal Simek <michal.simek@xilinx.com>
Cc: wsa@the-dreams.de, harinik@xilinx.com,
	soren.brinkmann@xilinx.com, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] i2c: cadence: Add an error handling for platform_get_irq()
Date: Sat, 23 May 2020 23:26:10 +0800	[thread overview]
Message-ID: <20200523152610.GA16405@nuc8i5> (raw)
In-Reply-To: <2d99f043-f854-8975-86ee-2f0ba1382275@xilinx.com>

On Fri, May 22, 2020 at 01:24:57PM +0200, Michal Simek wrote:
> On 20. 05. 20 16:48, Dejin Zheng wrote:
> > The driver initialization should be end immediately after found
> > the platform_get_irq() function return an error.
> > 
> > Fixes: df8eb5691c48d3b0 ("i2c: Add driver for Cadence I2C controller")
> 
> I wouldn't really consider this as bug. Driver is likely not failing
> when irq is not defined. It should just fail later on when
> devm_request_irq is called.
> Or is there any other issue with it?
> 
> > Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> > ---
> > v1 -> v2:
> > 	- add Fixes tag.
> > 
> >  drivers/i2c/busses/i2c-cadence.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> > index 89d58f7d2a25..0e8debe32cea 100644
> > --- a/drivers/i2c/busses/i2c-cadence.c
> > +++ b/drivers/i2c/busses/i2c-cadence.c
> > @@ -912,6 +912,8 @@ static int cdns_i2c_probe(struct platform_device *pdev)
> >  		return PTR_ERR(id->membase);
> >  
> >  	id->irq = platform_get_irq(pdev, 0);
> > +	if (id->irq < 0)
> > +		return id->irq;
> >  
> >  	id->adap.owner = THIS_MODULE;
> >  	id->adap.dev.of_node = pdev->dev.of_node;
> > 
> 
> The change is valid but the question is if make sense to do it in this
> way. Some drivers are using devm_request_irq to do do job.
> 
> For example:
>  	id->irq = platform_get_irq(pdev, 0);
>         ret = devm_request_irq(&pdev->dev, id->irq, cdns_i2c_isr, 0,
>                                   DRIVER_NAME, id);
>         if (ret)
> 		return ret;
> 
> But I am also fine with solution above where you fail in quickest way.
> 
> Without that Fixed tag
> Acked-by: Michal Simek <michal.simek@xilinx.com>
>

Michal, Thanks very much for review my patch, As you said, maybe the
better way is provide a function like the devm_platform_get_and_ioremap_resource().
So I resend a patch of I gave up before, It's here now:
https://patchwork.ozlabs.org/project/linux-i2c/patch/20200523145157.16257-3-zhengdejin5@gmail.com/

Abandon this patch and Thanks again!

BR,
Dejin

> Thanks,
> Michal

      parent reply	other threads:[~2020-05-23 15:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20 14:48 [PATCH v2] i2c: cadence: Add an error handling for platform_get_irq() Dejin Zheng
2020-05-22 11:24 ` Michal Simek
2020-05-22 15:14   ` Wolfram Sang
2020-05-22 15:26     ` Michal Simek
2020-05-22 20:19       ` Wolfram Sang
2020-05-23 13:36         ` Dejin Zheng
2020-05-23 15:26   ` Dejin Zheng [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=20200523152610.GA16405@nuc8i5 \
    --to=zhengdejin5@gmail.com \
    --cc=harinik@xilinx.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=soren.brinkmann@xilinx.com \
    --cc=wsa@the-dreams.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).