diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2013-08-13 13:35:43 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-08-27 15:07:29 -0400 |
commit | 7b360f4287e52802b8c62e0608737e8bbfda67e1 (patch) | |
tree | 8612951cac15b5e12f15a1b38679c4cb9176dfe7 /drivers/usb | |
parent | 5a68e9b57b1c1984dae8a9625bbf1a505d166035 (diff) |
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.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 4376f51f5ef1..696e9e0b05af 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, | |||
76 | return; | 76 | return; |
77 | 77 | ||
78 | if (request->request.dma == DMA_ADDR_INVALID) { | 78 | if (request->request.dma == DMA_ADDR_INVALID) { |
79 | request->request.dma = dma_map_single( | 79 | dma_addr_t dma_addr; |
80 | int ret; | ||
81 | |||
82 | dma_addr = dma_map_single( | ||
80 | musb->controller, | 83 | musb->controller, |
81 | request->request.buf, | 84 | request->request.buf, |
82 | request->request.length, | 85 | request->request.length, |
83 | request->tx | 86 | request->tx |
84 | ? DMA_TO_DEVICE | 87 | ? DMA_TO_DEVICE |
85 | : DMA_FROM_DEVICE); | 88 | : DMA_FROM_DEVICE); |
89 | ret = dma_mapping_error(musb->controller, dma_addr); | ||
90 | if (ret) | ||
91 | return; | ||
92 | |||
93 | request->request.dma = dma_addr; | ||
86 | request->map_state = MUSB_MAPPED; | 94 | request->map_state = MUSB_MAPPED; |
87 | } else { | 95 | } else { |
88 | dma_sync_single_for_device(musb->controller, | 96 | dma_sync_single_for_device(musb->controller, |