Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kim Phillips and committed by
Herbert Xu
2af8f4a2 6bbb98dd

+16 -8
+8 -8
drivers/crypto/caam/caamalg.c
··· 224 224 struct aead_tfm *tfm = &aead->base.crt_aead; 225 225 struct caam_ctx *ctx = crypto_aead_ctx(aead); 226 226 struct device *jrdev = ctx->jrdev; 227 - bool keys_fit_inline = 0; 227 + bool keys_fit_inline = false; 228 228 u32 *key_jump_cmd, *jump_cmd; 229 229 u32 geniv, moveiv; 230 230 u32 *desc; ··· 239 239 if (DESC_AEAD_ENC_LEN + DESC_JOB_IO_LEN + 240 240 ctx->split_key_pad_len + ctx->enckeylen <= 241 241 CAAM_DESC_BYTES_MAX) 242 - keys_fit_inline = 1; 242 + keys_fit_inline = true; 243 243 244 244 /* aead_encrypt shared descriptor */ 245 245 desc = ctx->sh_desc_enc; ··· 297 297 if (DESC_AEAD_DEC_LEN + DESC_JOB_IO_LEN + 298 298 ctx->split_key_pad_len + ctx->enckeylen <= 299 299 CAAM_DESC_BYTES_MAX) 300 - keys_fit_inline = 1; 300 + keys_fit_inline = true; 301 301 302 302 desc = ctx->sh_desc_dec; 303 303 ··· 365 365 if (DESC_AEAD_GIVENC_LEN + DESC_JOB_IO_LEN + 366 366 ctx->split_key_pad_len + ctx->enckeylen <= 367 367 CAAM_DESC_BYTES_MAX) 368 - keys_fit_inline = 1; 368 + keys_fit_inline = true; 369 369 370 370 /* aead_givencrypt shared descriptor */ 371 371 desc = ctx->sh_desc_givenc; ··· 1354 1354 contig &= ~GIV_SRC_CONTIG; 1355 1355 if (dst_nents || iv_dma + ivsize != sg_dma_address(req->dst)) 1356 1356 contig &= ~GIV_DST_CONTIG; 1357 - if (unlikely(req->src != req->dst)) { 1358 - dst_nents = dst_nents ? : 1; 1359 - sec4_sg_len += 1; 1360 - } 1357 + if (unlikely(req->src != req->dst)) { 1358 + dst_nents = dst_nents ? : 1; 1359 + sec4_sg_len += 1; 1360 + } 1361 1361 if (!(contig & GIV_SRC_CONTIG)) { 1362 1362 assoc_nents = assoc_nents ? : 1; 1363 1363 src_nents = src_nents ? : 1;
+4
drivers/crypto/caam/caamhash.c
··· 430 430 int ret = 0; 431 431 432 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 438 init_job_desc(desc, 0); 435 439
+4
drivers/crypto/caam/key_gen.c
··· 54 54 int ret = 0; 55 55 56 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 62 init_job_desc(desc, 0); 59 63