[U-Boot] dwc3: flush cache only if there is a buffer attached to a request
diff mbox series

Message ID 20191002121914.17438-1-m.szyprowski@samsung.com
State Accepted
Commit fd15b58c1a9a61edcdeef8ce1eb4df2442295f58
Delegated to: Lukasz Majewski
Headers show
Series
  • [U-Boot] dwc3: flush cache only if there is a buffer attached to a request
Related show

Commit Message

Marek Szyprowski Oct. 2, 2019, 12:19 p.m. UTC
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>
---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 085f7b8968..67d11b4c0d 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -242,7 +242,8 @@  void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
 
 	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;