From: Felipe Balbi <balbi@ti.com>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Felipe Balbi <balbi@ti.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
<rjw@rjwysocki.net>, Tony Lindgren <tmlind@atomide.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
<linux-pm@vger.kernel.org>,
Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH] base: power: wakeirq: don't leak dev->power.wakeirq
Date: Mon, 6 Jul 2015 13:09:21 -0500 [thread overview]
Message-ID: <20150706180921.GF20779@saruman.tx.rr.com> (raw)
In-Reply-To: <CAOf5uwnj=0m99E96k-+AYu68yE_UnX1WVU-=6y7OvJnfXKh8+g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]
On Mon, Jul 06, 2015 at 08:06:17PM +0200, Michael Trimarchi wrote:
> Hi
>
> On Jul 6, 2015 8:01 PM, "Felipe Balbi" <balbi@ti.com> wrote:
> >
> > on a first call to dev_pm_attach_wake_irq(), if it
> > fails, it will leave dev->power.wakeirq set to a
> > dangling pointer. Instead, let's clear it to make
> > sure a subsequent call to dev_pm_attach_wake_irq()
> > has chance to succeed.
> >
> > Cc: Tony Lindgren <tmlind@atomide.com>
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > ---
> > drivers/base/power/wakeirq.c | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c
> > index 7470004ca810..394d250a1ad8 100644
> > --- a/drivers/base/power/wakeirq.c
> > +++ b/drivers/base/power/wakeirq.c
> > @@ -50,9 +50,16 @@ static int dev_pm_attach_wake_irq(struct device *dev,
> int irq,
> >
> > err = device_wakeup_attach_irq(dev, wirq);
> > if (err)
> > - return err;
> > + goto err_cleanup;
> >
> > return 0;
> > +
> > +err_cleanup:
> > + spin_lock_irqsave(&dev->power.lock, flags);
> > + dev->power.wakeirq = NULL;
> > + spin_unlock_irqrestore(&dev->power.lock, flags);
> > +
>
> Why here and not in the fuction that return the error?
because the field was set here, why would I clear it elsewhere ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-07-06 18:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 18:01 [PATCH] base: power: wakeirq: don't leak dev->power.wakeirq Felipe Balbi
[not found] ` <CAOf5uwnj=0m99E96k-+AYu68yE_UnX1WVU-=6y7OvJnfXKh8+g@mail.gmail.com>
2015-07-06 18:09 ` Felipe Balbi [this message]
2015-07-07 4:17 ` Michael Trimarchi
2015-07-06 23:13 ` Rafael J. Wysocki
2015-07-07 7:40 ` Tony Lindgren
2015-07-07 8:11 ` Felipe Balbi
2015-07-07 11:11 ` Rafael J. Wysocki
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=20150706180921.GF20779@saruman.tx.rr.com \
--to=balbi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=michael@amarulasolutions.com \
--cc=rjw@rjwysocki.net \
--cc=tmlind@atomide.com \
--cc=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox