From: Kevin Hilman <khilman@mvista.com>
To: David Brownell <david-b@pacbell.net>
Cc: linux-omap-open-source@linux.omap.com
Subject: Re: [PATCH 1/2] ARM: OMAP: MUSB: dont exit with spinlock held
Date: Thu, 30 Aug 2007 22:51:35 -0700 [thread overview]
Message-ID: <46D7AC67.3010000@mvista.com> (raw)
In-Reply-To: <20070831054735.E513223744B@adsl-69-226-248-13.dsl.pltn13.pacbell.net>
David Brownell wrote:
>> From linux-omap-open-source-bounces@linux.omap.com Thu Aug 30 20:07:19 2007
>> Date: Thu, 30 Aug 2007 19:54:00 -0700
>> From: Kevin Hilman <khilman@mvista.com>
>> To: linux-omap-open-source@linux.omap.com
>> Subject: [PATCH 1/2] ARM: OMAP: MUSB: dont exit with spinlock held
>>
>> Signed-off-by: Kevin Hilman <khilman@mvista.com>
>>
>> ---
>> drivers/usb/musb/musb_core.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> Index: dev/drivers/usb/musb/musb_core.c
>> ===================================================================
>> --- dev.orig/drivers/usb/musb/musb_core.c
>> +++ dev/drivers/usb/musb/musb_core.c
>> @@ -1682,19 +1682,22 @@ musb_vbus_store(struct device *dev, stru
>> struct musb *musb = dev_to_musb(dev);
>> unsigned long flags;
>> unsigned long val;
>> + ssize_t retval = n;
>>
>> spin_lock_irqsave(&musb->lock, flags);
>> if (sscanf(buf, "%lu", &val) < 1) {
>
> What's it doing grabbing the spinlock before sscanf() anyway?
> It's not loke any protected data is handed off to sscanf()...
> This should instead be:
>
> if (sscanf(...)...)
> return -EINVAL
>
> spin_lock_irqsave(...)
>
> General rule of thumb: don't grab spinlocks earlier than necessary.
>
Agreed, will re-submit.
next prev parent reply other threads:[~2007-08-31 5:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-31 2:53 [PATCH 0/2] MUSB: tracking down locking bugs Kevin Hilman
2007-08-31 2:54 ` [PATCH 1/2] ARM: OMAP: MUSB: dont exit with spinlock held Kevin Hilman
2007-08-31 5:47 ` David Brownell
2007-08-31 5:51 ` Kevin Hilman [this message]
2007-08-31 2:54 ` [PATCH 2/2] ARM: OMAP: MUSB: BUG on potential deadlocks Kevin Hilman
2007-08-31 6:05 ` David Brownell
2007-08-31 16:18 ` Kevin Hilman
2007-08-31 17:49 ` David Brownell
2007-08-31 18:41 ` Kevin Hilman
2007-08-31 20:10 ` David Brownell
2007-08-31 5:48 ` [PATCH 0/2] MUSB: tracking down locking bugs David Brownell
2007-08-31 6:04 ` Kevin Hilman
2007-08-31 6:38 ` David Brownell
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=46D7AC67.3010000@mvista.com \
--to=khilman@mvista.com \
--cc=david-b@pacbell.net \
--cc=linux-omap-open-source@linux.omap.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