diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2013-12-25 07:01:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-07 19:15:39 -0500 |
commit | 252d74f6a875bcdee54cbcc82d7c02ee4fcece6b (patch) | |
tree | abc235efb8d24c9eda1a441efacfedfd56529e3a /drivers/usb/c67x00 | |
parent | 8f668fbbd571bbd5187a9a0eae150b768fc388ac (diff) |
USB: c67x00: move URB private data allocation from under spinlock
This fixes the following warning:
BUG: sleeping function called from invalid context at mm/slub.c:940
in_atomic(): 1, irqs_disabled(): 1, pid: 17, name: khubd
CPU: 0 PID: 17 Comm: khubd Not tainted 3.12.0-00004-g938dd60-dirty #1
__might_sleep+0xbe/0xc0
kmem_cache_alloc_trace+0x36/0x170
c67x00_urb_enqueue+0x5c/0x254
usb_hcd_submit_urb+0x66e/0x724
usb_submit_urb+0x2ac/0x308
usb_start_wait_urb+0x2c/0xb8
usb_control_msg+0x8c/0xa8
hub_port_init+0x191/0x718
hub_thread+0x804/0xe14
kthread+0x72/0x78
ret_from_kernel_thread+0x8/0xc
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/c67x00')
-rw-r--r-- | drivers/usb/c67x00/c67x00-sched.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c index c379d202f928..7311ed61e99a 100644 --- a/drivers/usb/c67x00/c67x00-sched.c +++ b/drivers/usb/c67x00/c67x00-sched.c | |||
@@ -362,6 +362,13 @@ int c67x00_urb_enqueue(struct usb_hcd *hcd, | |||
362 | struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd); | 362 | struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd); |
363 | int port = get_root_port(urb->dev)-1; | 363 | int port = get_root_port(urb->dev)-1; |
364 | 364 | ||
365 | /* Allocate and initialize urb private data */ | ||
366 | urbp = kzalloc(sizeof(*urbp), mem_flags); | ||
367 | if (!urbp) { | ||
368 | ret = -ENOMEM; | ||
369 | goto err_urbp; | ||
370 | } | ||
371 | |||
365 | spin_lock_irqsave(&c67x00->lock, flags); | 372 | spin_lock_irqsave(&c67x00->lock, flags); |
366 | 373 | ||
367 | /* Make sure host controller is running */ | 374 | /* Make sure host controller is running */ |
@@ -374,13 +381,6 @@ int c67x00_urb_enqueue(struct usb_hcd *hcd, | |||
374 | if (ret) | 381 | if (ret) |
375 | goto err_not_linked; | 382 | goto err_not_linked; |
376 | 383 | ||
377 | /* Allocate and initialize urb private data */ | ||
378 | urbp = kzalloc(sizeof(*urbp), mem_flags); | ||
379 | if (!urbp) { | ||
380 | ret = -ENOMEM; | ||
381 | goto err_urbp; | ||
382 | } | ||
383 | |||
384 | INIT_LIST_HEAD(&urbp->hep_node); | 384 | INIT_LIST_HEAD(&urbp->hep_node); |
385 | urbp->urb = urb; | 385 | urbp->urb = urb; |
386 | urbp->port = port; | 386 | urbp->port = port; |
@@ -443,11 +443,11 @@ int c67x00_urb_enqueue(struct usb_hcd *hcd, | |||
443 | return 0; | 443 | return 0; |
444 | 444 | ||
445 | err_epdata: | 445 | err_epdata: |
446 | kfree(urbp); | ||
447 | err_urbp: | ||
448 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 446 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
449 | err_not_linked: | 447 | err_not_linked: |
450 | spin_unlock_irqrestore(&c67x00->lock, flags); | 448 | spin_unlock_irqrestore(&c67x00->lock, flags); |
449 | kfree(urbp); | ||
450 | err_urbp: | ||
451 | 451 | ||
452 | return ret; | 452 | return ret; |
453 | } | 453 | } |