crypto: qat - fix unmap invalid dma address
'dma_mapping_error' return a negative value if 'dma_addr' is equal to 'DMA_MAPPING_ERROR' not zero, so fix initialization of 'dma_addr'. Signed-off-by: Hui Tang <tanghui20@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Родитель
282894556b
Коммит
792b32fad5
|
@ -719,7 +719,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
|
|||
struct qat_alg_buf_list *bufl;
|
||||
struct qat_alg_buf_list *buflout = NULL;
|
||||
dma_addr_t blp;
|
||||
dma_addr_t bloutp = 0;
|
||||
dma_addr_t bloutp;
|
||||
struct scatterlist *sg;
|
||||
size_t sz_out, sz = struct_size(bufl, bufers, n + 1);
|
||||
|
||||
|
@ -731,6 +731,9 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
|
|||
if (unlikely(!bufl))
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_sg(sgl, sg, n, i)
|
||||
bufl->bufers[i].addr = DMA_MAPPING_ERROR;
|
||||
|
||||
blp = dma_map_single(dev, bufl, sz, DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, blp)))
|
||||
goto err_in;
|
||||
|
@ -764,10 +767,14 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
|
|||
dev_to_node(&GET_DEV(inst->accel_dev)));
|
||||
if (unlikely(!buflout))
|
||||
goto err_in;
|
||||
|
||||
bufers = buflout->bufers;
|
||||
for_each_sg(sglout, sg, n, i)
|
||||
bufers[i].addr = DMA_MAPPING_ERROR;
|
||||
|
||||
bloutp = dma_map_single(dev, buflout, sz_out, DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, bloutp)))
|
||||
goto err_out;
|
||||
bufers = buflout->bufers;
|
||||
for_each_sg(sglout, sg, n, i) {
|
||||
int y = sg_nctr;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче