summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/caamalg_qi.c
diff options
context:
space:
mode:
authorCristian Stoica <cristian.stoica@freescale.com>2014-09-23 13:34:49 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:41:06 (GMT)
commitabfec970cb0f8384e9b10eef316393a2339e2d64 (patch)
tree6ba44b7ddebaaacb113b75d7bda298f05c47e427 /drivers/crypto/caam/caamalg_qi.c
parent2b79116058767a16442d3571505f151fe2df7280 (diff)
downloadlinux-fsl-qoriq-abfec970cb0f8384e9b10eef316393a2339e2d64.tar.xz
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 <cristian.stoica@freescale.com> Change-Id: I2fe2e3d4bd3c63b81f99065b0db159a009f217e6 Reviewed-on: http://git.am.freescale.net:8181/19806 Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Mircea Pop <mircea.pop@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Matthew Weigel <Matthew.Weigel@freescale.com>
Diffstat (limited to 'drivers/crypto/caam/caamalg_qi.c')
-rw-r--r--drivers/crypto/caam/caamalg_qi.c7
1 files changed, 4 insertions, 3 deletions
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);