swiotlb: fix map_sg failure handling

sg list elements might not be continuous.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
FUJITA Tomonori 2007-10-17 10:06:18 +02:00 committed by Jens Axboe
parent 24c31eede6
commit 9e91fdb32d

View File

@ -696,7 +696,7 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems,
/* Don't panic here, we expect map_sg users
to do proper error handling. */
swiotlb_full(hwdev, sg->length, dir, 0);
swiotlb_unmap_sg(hwdev, sg - i, i, dir);
swiotlb_unmap_sg(hwdev, sgl, i, dir);
sgl[0].dma_length = 0;
return 0;
}