UPSTREAM: 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.

Change-Id: Idf8e2c87a24c80627279faa69430881d5c2c6800
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit fd15b58c1a9a61edcdeef8ce1eb4df2442295f58)
This commit is contained in:
Marek Szyprowski 2019-10-02 14:19:14 +02:00 committed by Frank Wang
parent 10daf97492
commit 3a9207743d
1 changed files with 2 additions and 1 deletions

View File

@ -243,7 +243,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;