/* Returns a pointer to the allocated event buffer structure on success otherwise ERR_PTR(errno).  */
static struct dwc3_event_buffer* dwc3_alloc_one_event_buffer(struct dwc3 *dwc, unsigned length)
/* Returns a pointer to the allocated event buffer structure on success otherwise ERR_PTR(errno).  */
static struct dwc3_event_buffer* dwc3_alloc_one_event_buffer(struct dwc3 *dwc, unsigned length)
{
	struct dwc3_event_buffer	*evt;
	evt = devm_kzalloc((struct udevice *)dwc->dev, sizeof(*evt),
			   GFP_KERNEL);
	if (!evt)
		return ERR_PTR(-ENOMEM);
	evt->dwc	= dwc;
	evt->length	= length;
	evt->buf	= dma_alloc_coherent(length,
					     (unsigned long *)&evt->dma);
	if (!evt->buf)
		return ERR_PTR(-ENOMEM);
	dwc3_flush_cache((uintptr_t)evt->buf, evt->length);
	return evt;
}