mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Mathias Krause <minipli@googlemail.com>
Cc: Felipe Balbi <balbi@ti.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	PaX Team <pageexec@freemail.hu>,
	Anton Vorontsov <anton@enomsg.org>
Subject: Re: [PATCH 2/2] pda_power: Unregister USB notifier in pda_power_remove()
Date: Mon, 14 Apr 2014 17:08:05 -0500	[thread overview]
Message-ID: <20140414220804.GB22800@saruman.home> (raw)
In-Reply-To: <CA+rthh__aRaY+DQ7drj_MPB3Gb35RFFUCd50ZN_pQR3OGr2GEw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]

On Tue, Apr 15, 2014 at 12:07:13AM +0200, Mathias Krause wrote:
> On 14 April 2014 23:35, Felipe Balbi <balbi@ti.com> wrote:
> > On Sun, Mar 30, 2014 at 03:34:15PM +0200, Mathias Krause wrote:
> >> If we've registered a notifier in pda_power_probe() we must deregister
> >> it in pda_power_remove() to not let it work on stale data like, e.g.,
> >> the charger timer.
> >>
> >> Cc: Felipe Balbi <balbi@ti.com>
> >> Cc: Anton Vorontsov <anton@enomsg.org>
> >> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> >> ---
> >>  drivers/power/pda_power.c |    5 +++++
> >>  1 file changed, 5 insertions(+)
> >>
> >> diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
> >> index 87a963d0a8..aba23d6848 100644
> >> --- a/drivers/power/pda_power.c
> >> +++ b/drivers/power/pda_power.c
> >> @@ -430,6 +430,11 @@ static int pda_power_remove(struct platform_device *pdev)
> >>       if (pdata->is_ac_online && ac_irq)
> >>               free_irq(ac_irq->start, &pda_psy_ac);
> >>
> >> +#if IS_ENABLED(CONFIG_USB_PHY)
> >> +     if (!IS_ERR_OR_NULL(transceiver) && pdata->use_otg_notifier)
> >
> > IS_ERR() should be enough here.
> 
> That's true! The usb_get_phy() call in pda_power_probe() will always
> return a valid pointer or an ERR_PTR() -- never NULL. Albeit, looking
> at usb_get_phy(), it contains another bug, returning a valid pointer,
> even when the try_module_get() call fails. *sigh* It should set ptr to
> an ERR_PTR() in this case.

good catch, can you send a patch for that ?

> Anyway, probably all the transceiver checks in pda_power.c can be
> changed to IS_ERR() checks. The reason I am using IS_ERR_OR_NULL() in
> my patch is that I just copied the test from a few lines below. I'll
> create a follow up patch in case somebody cares about this series in
> the first place.

awesome, thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-04-14 22:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-30 13:34 [PATCH 0/2] pda_power: USB notifier fixes Mathias Krause
2014-03-30 13:34 ` [PATCH 1/2] pda_power: Statically initialize notifier block Mathias Krause
2014-03-30 13:34 ` [PATCH 2/2] pda_power: Unregister USB notifier in pda_power_remove() Mathias Krause
2014-04-14 21:35   ` Felipe Balbi
2014-04-14 22:07     ` Mathias Krause
2014-04-14 22:08       ` Felipe Balbi [this message]
2014-04-14 22:11         ` Mathias Krause
2014-04-14 19:51 ` [PATCH 0/2] pda_power: USB notifier fixes Mathias Krause

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=20140414220804.GB22800@saruman.home \
    --to=balbi@ti.com \
    --cc=anton@enomsg.org \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minipli@googlemail.com \
    --cc=pageexec@freemail.hu \
    /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®