From: Pavel Machek <pavel@denx.de>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Detlev Zundel <dzu@denx.de>, "Hans J. Koch" <hjk@hansjkoch.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <rob.herring@calxeda.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
trivial <trivial@kernel.org>
Subject: Re: [PATCH] fix UIO with device tree but no assigned interrupt
Date: Tue, 18 Jun 2013 16:24:43 +0200 [thread overview]
Message-ID: <20130618142442.GA17361@amd.pavel.ucw.cz> (raw)
In-Reply-To: <CACxGe6tLPfJ3KS6+4aO8s8emq8=ajuc+gmBtaEDqd60m4_vx6w@mail.gmail.com>
Hi!
> > If device is initialized from device tree, but has no interrupt
> > assigned, uio will still try to request and interrupt old way, fails,
> > and fails registration.
> >
> > This is wrong; don't try initializing irq using platform data if
> > device tree is available.
> >
> > Simplified code based on suggestion by Grant Likely.
> >
> > Fixed memory leak in "irq can not be registered" error path.
> >
> > Signed-off-by: Pavel Machek <pavel@denx.de>
> > Reported-by: Detlev Zundel <dzu@denx.de>
> > @@ -146,14 +138,15 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
> > priv->flags = 0; /* interrupt is enabled to begin with */
> > priv->pdev = pdev;
> >
> > - if (!uioinfo->irq) {
> > - ret = platform_get_irq(pdev, 0);
> > - if (ret < 0) {
> > - dev_err(&pdev->dev, "failed to get IRQ\n");
> > - goto bad0;
> > - }
> > - uioinfo->irq = ret;
> > + ret = platform_get_irq(pdev, 0);
> > + uioinfo->irq = ret;
> > + if (ret == -ENXIO && pdev->dev.of_node)
> > + uioinfo->irq = UIO_IRQ_NONE;
>
> This short-circuits the platform data use case where uioinfo->irq is
> already set. The if (!uioinfo->irq) test is still needed. The original
> code looks like it already handles it correctly for both the
> platform_data and DT use cases because in the DT case the uioinfo
> structure is zeroed by kzalloc().
Ok, fixed, thanks!
> As an aside, switching to devm_kzalloc() would simplify the unwind
> path.
Well, lets leave that for another day...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2013-06-18 14:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-17 13:49 Pavel Machek
2013-06-17 23:46 ` Greg KH
2013-06-18 12:53 ` Pavel Machek
2013-06-18 9:03 ` Grant Likely
2013-06-18 12:52 ` Pavel Machek
2013-06-18 14:08 ` Grant Likely
2013-06-18 14:24 ` Pavel Machek [this message]
2013-06-18 14:26 ` Pavel Machek
2013-06-18 17:58 ` Greg Kroah-Hartman
2013-06-18 20:37 ` Pavel Machek
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=20130618142442.GA17361@amd.pavel.ucw.cz \
--to=pavel@denx.de \
--cc=dzu@denx.de \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=hjk@hansjkoch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=trivial@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
all inboxes | Powered by JetHome®