Skip to content

Commit bcdda43

Browse files
committed
crypto: crypto4xx - Call dma_unmap_page when done
In crypto4xx_cipher_done, we should be unmapping the dst page, not mapping it. This was flagged by a sparse warning about the unused addr variable. While we're at it, also fix a sparse warning regarding the unused ctx variable in crypto4xx_ahash_done (by actually using it). Fixes: 049359d ("crypto: amcc - Add crypt4xx driver") Signed-off-by: Herbert Xu <[email protected]> Tested-by: Christian Lamparter <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 72bc4e7 commit bcdda43

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/crypto/amcc/crypto4xx_core.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ static void crypto4xx_cipher_done(struct crypto4xx_device *dev,
522522
{
523523
struct skcipher_request *req;
524524
struct scatterlist *dst;
525-
dma_addr_t addr;
526525

527526
req = skcipher_request_cast(pd_uinfo->async_req);
528527

@@ -531,8 +530,8 @@ static void crypto4xx_cipher_done(struct crypto4xx_device *dev,
531530
req->cryptlen, req->dst);
532531
} else {
533532
dst = pd_uinfo->dest_va;
534-
addr = dma_map_page(dev->core_dev->device, sg_page(dst),
535-
dst->offset, dst->length, DMA_FROM_DEVICE);
533+
dma_unmap_page(dev->core_dev->device, pd->dest, dst->length,
534+
DMA_FROM_DEVICE);
536535
}
537536

538537
if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) {
@@ -557,10 +556,9 @@ static void crypto4xx_ahash_done(struct crypto4xx_device *dev,
557556
struct ahash_request *ahash_req;
558557

559558
ahash_req = ahash_request_cast(pd_uinfo->async_req);
560-
ctx = crypto_tfm_ctx(ahash_req->base.tfm);
559+
ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(ahash_req));
561560

562-
crypto4xx_copy_digest_to_dst(ahash_req->result, pd_uinfo,
563-
crypto_tfm_ctx(ahash_req->base.tfm));
561+
crypto4xx_copy_digest_to_dst(ahash_req->result, pd_uinfo, ctx);
564562
crypto4xx_ret_sg_desc(dev, pd_uinfo);
565563

566564
if (pd_uinfo->state & PD_ENTRY_BUSY)

0 commit comments

Comments
 (0)