Skip to content

Commit

Permalink
usb: dwc3: core: don't kfree() devm_kzalloc()'ed memory
Browse files Browse the repository at this point in the history
commit 380f0d2 (usb: dwc3: core: switch event
buffer allocation to devm_kzalloc()) was incomplete
leaving a trailing kfree(evt) in an error exit
path.

Fix this problem by removing the trailing kfree(evt).

Cc: Julia Lawall <julia.lawall@lip6.fr>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Felipe Balbi committed Nov 8, 2012
1 parent 7947699 commit e32672f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,8 @@ dwc3_alloc_one_event_buffer(struct dwc3 *dwc, unsigned length)
evt->length = length;
evt->buf = dma_alloc_coherent(dwc->dev, length,
&evt->dma, GFP_KERNEL);
if (!evt->buf) {
kfree(evt);
if (!evt->buf)
return ERR_PTR(-ENOMEM);
}

return evt;
}
Expand Down

0 comments on commit e32672f

Please sign in to comment.