* [PATCH] usb: gadget: udc: mv_udc_core: Check error dma address
@ 2021-12-22 10:00 Jiasheng Jiang
0 siblings, 0 replies; only message in thread
From: Jiasheng Jiang @ 2021-12-22 10:00 UTC (permalink / raw)
To: balbi, gregkh; +Cc: linux-usb, linux-kernel, Jiasheng Jiang
Because the dma_map_single() might return error dma address if fails.
Therefore it might be better to check the address in order to avoid the
use of error dma address in build_dtd() which is called by req_to_dtd().
Fixes: 90fccb529d24 ("usb: gadget: Gadget directory cleanup - group UDC drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/usb/gadget/udc/mv_udc_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
index 0fb4ef464321..2613dbdc5aba 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -1472,6 +1472,9 @@ udc_prime_status(struct mv_udc *udc, u8 direction, u16 status, bool empty)
req->req.dma = dma_map_single(ep->udc->gadget.dev.parent,
req->req.buf, req->req.length,
ep_dir(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+ retval = dma_mapping_error(ep->udc->gadget.dev.parent, req->req.dma);
+ if (retval)
+ goto out;
req->mapped = 1;
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-22 10:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 10:00 [PATCH] usb: gadget: udc: mv_udc_core: Check error dma address Jiasheng Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).