dwc3: flush cache only if there is a buffer attached to a request
Calling cache flush on invalid buffer, even with zero length might cause
an exception on certain platforms.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 085f7b8..67d11b4 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -242,7 +242,8 @@
list_del(&req->list);
req->trb = NULL;
- dwc3_flush_cache((uintptr_t)req->request.dma, req->request.length);
+ if (req->request.length)
+ dwc3_flush_cache((uintptr_t)req->request.dma, req->request.length);
if (req->request.status == -EINPROGRESS)
req->request.status = status;