From abfec970cb0f8384e9b10eef316393a2339e2d64 Mon Sep 17 00:00:00 2001 From: Cristian Stoica Date: Tue, 23 Sep 2014 16:34:49 +0300 Subject: crypto: caamalg_qi: remove redundant checks on fast path The function is called with arguments known at compile time. Remove runtime checks for out of bound values. Signed-off-by: Cristian Stoica Change-Id: I2fe2e3d4bd3c63b81f99065b0db159a009f217e6 Reviewed-on: http://git.am.freescale.net:8181/19806 Reviewed-by: Horia Ioan Geanta Neag Reviewed-by: Mircea Pop Tested-by: Review Code-CDREVIEW Reviewed-by: Matthew Weigel diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c index 4334f82..5aa72ec 100644 --- a/drivers/crypto/caam/caamalg_qi.c +++ b/drivers/crypto/caam/caamalg_qi.c @@ -1249,6 +1249,9 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, static struct caam_drv_ctx *get_drv_ctx(struct caam_ctx *ctx, enum optype type) { + /* This function is called on the fast path with values of 'type' + * known at compile time. Invalid arguments are not expected and + * thus no checks are made */ struct caam_drv_ctx *drv_ctx = ctx->drv_ctx[type]; u32 *desc; @@ -1264,10 +1267,8 @@ static struct caam_drv_ctx *get_drv_ctx(struct caam_ctx *ctx, desc = ctx->sh_desc_enc; else if (DECRYPT == type) desc = ctx->sh_desc_dec; - else if (GIVENCRYPT == type) + else /* (GIVENCRYPT == type) */ desc = ctx->sh_desc_givenc; - else - return ERR_PTR(-EINVAL); cpu = smp_processor_id(); drv_ctx = caam_drv_ctx_init(ctx->qidev, &cpu, desc); -- cgit v0.10.2