crypto: caam - check and use dma_map_sg() return code
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 8 Aug 2016 17:05:03 +0000 (18:05 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 9 Aug 2016 10:47:26 +0000 (18:47 +0800)
commitbc13c69e29697f90200cf77d133a39ca1e525590
tree6c4203cb9a932d949d81ccb0971953ebfd2c38eb
parent32686d34f8fb6919df491ddb7ad8a0d6a9164624
crypto: caam - check and use dma_map_sg() return code

Strictly, dma_map_sg() may coalesce SG entries, but in practise on iMX
hardware, this will never happen.  However, dma_map_sg() can fail, and
we completely fail to check its return value.  So, fix this properly.

Arrange the code to map the scatterlist early, so we know how many
scatter table entries to allocate, and then fill them in.  This allows
us to keep relatively simple error cleanup paths.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caamhash.c