]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dwc3: flush cache only if there is a buffer attached to a request
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 2 Oct 2019 12:19:14 +0000 (14:19 +0200)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Thu, 31 Oct 2019 11:12:31 +0000 (12:12 +0100)
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

index 085f7b8968842bbdae3f08ac543b3b72ba96afda..67d11b4c0d7e9e2f2f2a3af2b1f04710a8c47352 100644 (file)
@@ -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;