diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index d8d327a5e53b1b0c2be21410df165745da5f25ce..2bd007d1646164ed3b5d7279eefd1678037615b8 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -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; }