Skip to content

Commit

Permalink
usb: gadget: gr_udc: Use GFP_ATOMIC when allocating under held spinlock
Browse files Browse the repository at this point in the history
As gr_ep_init must be called with dev->lock held, GFP_KERNEL must not be used.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Andreas Larsson authored and Felipe Balbi committed Apr 21, 2014
1 parent b38d27e commit 8652bcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/gr_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,8 +1990,8 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit)
INIT_LIST_HEAD(&ep->queue);

if (num == 0) {
_req = gr_alloc_request(&ep->ep, GFP_KERNEL);
buf = devm_kzalloc(dev->dev, PAGE_SIZE, GFP_DMA | GFP_KERNEL);
_req = gr_alloc_request(&ep->ep, GFP_ATOMIC);
buf = devm_kzalloc(dev->dev, PAGE_SIZE, GFP_DMA | GFP_ATOMIC);
if (!_req || !buf) {
/* possible _req freed by gr_probe via gr_remove */
return -ENOMEM;
Expand Down

0 comments on commit 8652bcb

Please sign in to comment.