IB/ipath: Check return value of dma_map_single()
This fixes an obvious oversight where the return value is not checked for error. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
fab01fc560
commit
890fccb242
1 changed files with 15 additions and 4 deletions
|
@ -698,10 +698,8 @@ retry:
|
||||||
|
|
||||||
addr = dma_map_single(&dd->pcidev->dev, tx->txreq.map_addr,
|
addr = dma_map_single(&dd->pcidev->dev, tx->txreq.map_addr,
|
||||||
tx->map_len, DMA_TO_DEVICE);
|
tx->map_len, DMA_TO_DEVICE);
|
||||||
if (dma_mapping_error(&dd->pcidev->dev, addr)) {
|
if (dma_mapping_error(&dd->pcidev->dev, addr))
|
||||||
ret = -EIO;
|
goto ioerr;
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwoffset = tx->map_len >> 2;
|
dwoffset = tx->map_len >> 2;
|
||||||
make_sdma_desc(dd, sdmadesc, (u64) addr, dwoffset, 0);
|
make_sdma_desc(dd, sdmadesc, (u64) addr, dwoffset, 0);
|
||||||
|
@ -741,6 +739,8 @@ retry:
|
||||||
dw = (len + 3) >> 2;
|
dw = (len + 3) >> 2;
|
||||||
addr = dma_map_single(&dd->pcidev->dev, sge->vaddr, dw << 2,
|
addr = dma_map_single(&dd->pcidev->dev, sge->vaddr, dw << 2,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
|
if (dma_mapping_error(&dd->pcidev->dev, addr))
|
||||||
|
goto unmap;
|
||||||
make_sdma_desc(dd, sdmadesc, (u64) addr, dw, dwoffset);
|
make_sdma_desc(dd, sdmadesc, (u64) addr, dw, dwoffset);
|
||||||
/* SDmaUseLargeBuf has to be set in every descriptor */
|
/* SDmaUseLargeBuf has to be set in every descriptor */
|
||||||
if (tx->txreq.flags & IPATH_SDMA_TXREQ_F_USELARGEBUF)
|
if (tx->txreq.flags & IPATH_SDMA_TXREQ_F_USELARGEBUF)
|
||||||
|
@ -798,7 +798,18 @@ retry:
|
||||||
list_add_tail(&tx->txreq.list, &dd->ipath_sdma_activelist);
|
list_add_tail(&tx->txreq.list, &dd->ipath_sdma_activelist);
|
||||||
if (tx->txreq.flags & IPATH_SDMA_TXREQ_F_VL15)
|
if (tx->txreq.flags & IPATH_SDMA_TXREQ_F_VL15)
|
||||||
vl15_watchdog_enq(dd);
|
vl15_watchdog_enq(dd);
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
|
unmap:
|
||||||
|
while (tail != dd->ipath_sdma_descq_tail) {
|
||||||
|
if (!tail)
|
||||||
|
tail = dd->ipath_sdma_descq_cnt - 1;
|
||||||
|
else
|
||||||
|
tail--;
|
||||||
|
unmap_desc(dd, tail);
|
||||||
|
}
|
||||||
|
ioerr:
|
||||||
|
ret = -EIO;
|
||||||
unlock:
|
unlock:
|
||||||
spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags);
|
spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags);
|
||||||
fail:
|
fail:
|
||||||
|
|
Loading…
Add table
Reference in a new issue