diff options
author | Kim Phillips <kim.phillips@freescale.com> | 2012-09-06 16:17:03 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-09-06 16:17:03 -0400 |
commit | 2af8f4a2727998eb3f4ff1edfffaca99955ef22e (patch) | |
tree | 8afadd6ec6ed66f25635b27c13c487f1dac06047 /drivers/crypto | |
parent | 6bbb98ddfc8db769c1675cc8d829ce720a735fc6 (diff) |
crypto: caam - coccicheck fixes
use true/false for bool, fix code alignment, and fix two allocs with
no test.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 16 | ||||
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 4 | ||||
-rw-r--r-- | drivers/crypto/caam/key_gen.c | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 6b48295e218b..cf268b14ae9a 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -224,7 +224,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) | |||
224 | struct aead_tfm *tfm = &aead->base.crt_aead; | 224 | struct aead_tfm *tfm = &aead->base.crt_aead; |
225 | struct caam_ctx *ctx = crypto_aead_ctx(aead); | 225 | struct caam_ctx *ctx = crypto_aead_ctx(aead); |
226 | struct device *jrdev = ctx->jrdev; | 226 | struct device *jrdev = ctx->jrdev; |
227 | bool keys_fit_inline = 0; | 227 | bool keys_fit_inline = false; |
228 | u32 *key_jump_cmd, *jump_cmd; | 228 | u32 *key_jump_cmd, *jump_cmd; |
229 | u32 geniv, moveiv; | 229 | u32 geniv, moveiv; |
230 | u32 *desc; | 230 | u32 *desc; |
@@ -239,7 +239,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) | |||
239 | if (DESC_AEAD_ENC_LEN + DESC_JOB_IO_LEN + | 239 | if (DESC_AEAD_ENC_LEN + DESC_JOB_IO_LEN + |
240 | ctx->split_key_pad_len + ctx->enckeylen <= | 240 | ctx->split_key_pad_len + ctx->enckeylen <= |
241 | CAAM_DESC_BYTES_MAX) | 241 | CAAM_DESC_BYTES_MAX) |
242 | keys_fit_inline = 1; | 242 | keys_fit_inline = true; |
243 | 243 | ||
244 | /* aead_encrypt shared descriptor */ | 244 | /* aead_encrypt shared descriptor */ |
245 | desc = ctx->sh_desc_enc; | 245 | desc = ctx->sh_desc_enc; |
@@ -297,7 +297,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) | |||
297 | if (DESC_AEAD_DEC_LEN + DESC_JOB_IO_LEN + | 297 | if (DESC_AEAD_DEC_LEN + DESC_JOB_IO_LEN + |
298 | ctx->split_key_pad_len + ctx->enckeylen <= | 298 | ctx->split_key_pad_len + ctx->enckeylen <= |
299 | CAAM_DESC_BYTES_MAX) | 299 | CAAM_DESC_BYTES_MAX) |
300 | keys_fit_inline = 1; | 300 | keys_fit_inline = true; |
301 | 301 | ||
302 | desc = ctx->sh_desc_dec; | 302 | desc = ctx->sh_desc_dec; |
303 | 303 | ||
@@ -365,7 +365,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) | |||
365 | if (DESC_AEAD_GIVENC_LEN + DESC_JOB_IO_LEN + | 365 | if (DESC_AEAD_GIVENC_LEN + DESC_JOB_IO_LEN + |
366 | ctx->split_key_pad_len + ctx->enckeylen <= | 366 | ctx->split_key_pad_len + ctx->enckeylen <= |
367 | CAAM_DESC_BYTES_MAX) | 367 | CAAM_DESC_BYTES_MAX) |
368 | keys_fit_inline = 1; | 368 | keys_fit_inline = true; |
369 | 369 | ||
370 | /* aead_givencrypt shared descriptor */ | 370 | /* aead_givencrypt shared descriptor */ |
371 | desc = ctx->sh_desc_givenc; | 371 | desc = ctx->sh_desc_givenc; |
@@ -1354,10 +1354,10 @@ static struct aead_edesc *aead_giv_edesc_alloc(struct aead_givcrypt_request | |||
1354 | contig &= ~GIV_SRC_CONTIG; | 1354 | contig &= ~GIV_SRC_CONTIG; |
1355 | if (dst_nents || iv_dma + ivsize != sg_dma_address(req->dst)) | 1355 | if (dst_nents || iv_dma + ivsize != sg_dma_address(req->dst)) |
1356 | contig &= ~GIV_DST_CONTIG; | 1356 | contig &= ~GIV_DST_CONTIG; |
1357 | if (unlikely(req->src != req->dst)) { | 1357 | if (unlikely(req->src != req->dst)) { |
1358 | dst_nents = dst_nents ? : 1; | 1358 | dst_nents = dst_nents ? : 1; |
1359 | sec4_sg_len += 1; | 1359 | sec4_sg_len += 1; |
1360 | } | 1360 | } |
1361 | if (!(contig & GIV_SRC_CONTIG)) { | 1361 | if (!(contig & GIV_SRC_CONTIG)) { |
1362 | assoc_nents = assoc_nents ? : 1; | 1362 | assoc_nents = assoc_nents ? : 1; |
1363 | src_nents = src_nents ? : 1; | 1363 | src_nents = src_nents ? : 1; |
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index fbf3fe8b62f0..32aba7a61503 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c | |||
@@ -430,6 +430,10 @@ static u32 hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in, | |||
430 | int ret = 0; | 430 | int ret = 0; |
431 | 431 | ||
432 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); | 432 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); |
433 | if (!desc) { | ||
434 | dev_err(jrdev, "unable to allocate key input memory\n"); | ||
435 | return -ENOMEM; | ||
436 | } | ||
433 | 437 | ||
434 | init_job_desc(desc, 0); | 438 | init_job_desc(desc, 0); |
435 | 439 | ||
diff --git a/drivers/crypto/caam/key_gen.c b/drivers/crypto/caam/key_gen.c index 002888185f17..f5c0d56764cc 100644 --- a/drivers/crypto/caam/key_gen.c +++ b/drivers/crypto/caam/key_gen.c | |||
@@ -54,6 +54,10 @@ u32 gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, | |||
54 | int ret = 0; | 54 | int ret = 0; |
55 | 55 | ||
56 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); | 56 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); |
57 | if (!desc) { | ||
58 | dev_err(jrdev, "unable to allocate key input memory\n"); | ||
59 | return -ENOMEM; | ||
60 | } | ||
57 | 61 | ||
58 | init_job_desc(desc, 0); | 62 | init_job_desc(desc, 0); |
59 | 63 | ||