diff options
-rw-r--r-- | drivers/crypto/caam/ctrl.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index dcf360c..17c4cb9 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -85,7 +85,7 @@ static inline int run_descriptor_deco0(struct device *ctrldev, u32 *desc, struct caam_deco __iomem *deco = ctrlpriv->deco; unsigned int timeout = 100000; u32 deco_dbg_reg, flags; - int i; + int i, ret; if (ctrlpriv->virt_en == 1) { @@ -106,8 +106,8 @@ static inline int run_descriptor_deco0(struct device *ctrldev, u32 *desc, if (!timeout) { dev_err(ctrldev, "failed to acquire DECO 0\n"); - clrbits32(&ctrl->deco_rq, DECORR_RQD0ENABLE); - return -ENODEV; + ret = -ENODEV; + goto out_err; } for (i = 0; i < desc_len(desc); i++) @@ -143,13 +143,12 @@ static inline int run_descriptor_deco0(struct device *ctrldev, u32 *desc, if (ctrlpriv->virt_en == 1) clrbits32(&ctrl->deco_rsr, DECORSR_JR0); + ret = timeout ? 0 : -EAGAIN; + +out_err: /* Mark the DECO as free */ clrbits32(&ctrl->deco_rq, DECORR_RQD0ENABLE); - - if (!timeout) - return -EAGAIN; - - return 0; + return ret; } /* |