crypto: ccp - use dma_mapping_error to check map error
authorPan Bian <bianpan2016@163.com>
Tue, 8 Aug 2017 13:42:47 +0000 (21:42 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 17 Aug 2017 08:53:33 +0000 (16:53 +0800)
The return value of dma_map_single() should be checked by
dma_mapping_error(). However, in function ccp_init_dm_workarea(), its
return value is checked against NULL, which could result in failures.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Acked-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/ccp-ops.c

index 804924e48c898dd425ea413e3eaef6ba5757107d..406b95329b3d27e45b94cc66d8d82a1d5bf6776b 100644 (file)
@@ -168,7 +168,7 @@ static int ccp_init_dm_workarea(struct ccp_dm_workarea *wa,
 
                wa->dma.address = dma_map_single(wa->dev, wa->address, len,
                                                 dir);
-               if (!wa->dma.address)
+               if (dma_mapping_error(wa->dev, wa->dma.address))
                        return -ENOMEM;
 
                wa->dma.length = len;