提交 197272b8 编写于 作者: K Kai Ye 提交者: Herbert Xu

crypto: hisilicon/sgl - add some dfx logs

Add some dfx logs in some abnormal exit situations.
Signed-off-by: NKai Ye <yekai13@huawei.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 c5f735bb
...@@ -90,8 +90,10 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev, ...@@ -90,8 +90,10 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev,
block[i].sgl = dma_alloc_coherent(dev, block_size, block[i].sgl = dma_alloc_coherent(dev, block_size,
&block[i].sgl_dma, &block[i].sgl_dma,
GFP_KERNEL); GFP_KERNEL);
if (!block[i].sgl) if (!block[i].sgl) {
dev_err(dev, "Fail to allocate hw SG buffer!\n");
goto err_free_mem; goto err_free_mem;
}
block[i].size = block_size; block[i].size = block_size;
} }
...@@ -100,8 +102,10 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev, ...@@ -100,8 +102,10 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev,
block[i].sgl = dma_alloc_coherent(dev, remain_sgl * sgl_size, block[i].sgl = dma_alloc_coherent(dev, remain_sgl * sgl_size,
&block[i].sgl_dma, &block[i].sgl_dma,
GFP_KERNEL); GFP_KERNEL);
if (!block[i].sgl) if (!block[i].sgl) {
dev_err(dev, "Fail to allocate remained hw SG buffer!\n");
goto err_free_mem; goto err_free_mem;
}
block[i].size = remain_sgl * sgl_size; block[i].size = remain_sgl * sgl_size;
} }
...@@ -216,16 +220,19 @@ hisi_acc_sg_buf_map_to_hw_sgl(struct device *dev, ...@@ -216,16 +220,19 @@ hisi_acc_sg_buf_map_to_hw_sgl(struct device *dev,
sg_n = sg_nents(sgl); sg_n = sg_nents(sgl);
sg_n_mapped = dma_map_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL); sg_n_mapped = dma_map_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
if (!sg_n_mapped) if (!sg_n_mapped) {
dev_err(dev, "DMA mapping for SG error!\n");
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
}
if (sg_n_mapped > pool->sge_nr) { if (sg_n_mapped > pool->sge_nr) {
dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL); dev_err(dev, "the number of entries in input scatterlist is bigger than SGL pool setting.\n");
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
curr_hw_sgl = acc_get_sgl(pool, index, &curr_sgl_dma); curr_hw_sgl = acc_get_sgl(pool, index, &curr_sgl_dma);
if (IS_ERR(curr_hw_sgl)) { if (IS_ERR(curr_hw_sgl)) {
dev_err(dev, "Get SGL error!\n");
dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL); dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册