crypto: inside-secure - avoid unmapping DMA memory that was not mapped
authorAntoine Ténart <antoine.tenart@free-electrons.com>
Tue, 26 Dec 2017 16:21:16 +0000 (17:21 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 5 Jan 2018 07:43:05 +0000 (18:43 +1100)
commitc957f8b3e2e54b29f53ef69decc87bbc858c9b58
treedd21c039ce87dad8711b670fe456b27dd7daa224
parent0b5a7f71b4c557b15ec54a1b49023bc1b21044cc
crypto: inside-secure - avoid unmapping DMA memory that was not mapped

This patch adds a parameter in the SafeXcel ahash request structure to
keep track of the number of SG entries mapped. This allows not to call
dma_unmap_sg() when dma_map_sg() wasn't called in the first place. This
also removes a warning when the debugging of the DMA-API is enabled in
the kernel configuration: "DMA-API: device driver tries to free DMA
memory it has not allocated".

Cc: stable@vger.kernel.org
Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/inside-secure/safexcel_hash.c