summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2013-08-13 19:35:43 +0200
committerFelipe Balbi <balbi@ti.com>2013-08-27 14:07:29 -0500
commit7b360f4287e52802b8c62e0608737e8bbfda67e1 (patch)
tree8612951cac15b5e12f15a1b38679c4cb9176dfe7 /drivers/usb
parent5a68e9b57b1c1984dae8a9625bbf1a505d166035 (diff)
downloadop-kernel-dev-7b360f4287e52802b8c62e0608737e8bbfda67e1.zip
op-kernel-dev-7b360f4287e52802b8c62e0608737e8bbfda67e1.tar.gz
usb: musb: honour the return value of dma_map_single()
Since dma_map_single() may fail it is good to actually check the return code to see if it succeeded. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/musb/musb_gadget.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 4376f51..696e9e0 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -76,13 +76,21 @@ static inline void map_dma_buffer(struct musb_request *request,
return;
if (request->request.dma == DMA_ADDR_INVALID) {
- request->request.dma = dma_map_single(
+ dma_addr_t dma_addr;
+ int ret;
+
+ dma_addr = dma_map_single(
musb->controller,
request->request.buf,
request->request.length,
request->tx
? DMA_TO_DEVICE
: DMA_FROM_DEVICE);
+ ret = dma_mapping_error(musb->controller, dma_addr);
+ if (ret)
+ return;
+
+ request->request.dma = dma_addr;
request->map_state = MUSB_MAPPED;
} else {
dma_sync_single_for_device(musb->controller,
OpenPOWER on IntegriCloud