diff options
author | Cristian Stoica <cristian.stoica@freescale.com> | 2014-09-23 10:59:21 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:41:01 (GMT) |
commit | e8b69435af3cb76513b95e7ba7d817b2325089ba (patch) | |
tree | bf3c9f1d3d43f0bcef9799a32ffc041b8683abf7 | |
parent | 0de60bc90aaadc0fbde2ec755d6b37775f7e124e (diff) | |
download | linux-fsl-qoriq-e8b69435af3cb76513b95e7ba7d817b2325089ba.tar.xz |
crypto: caamctrl refactoring: remove code duplication
Both error and normal paths call clrbits32 before returning. Put this
call in a single place to avoid code duplication
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
(cherry picked from commit c75e03a2d47583e39f46c2925abd0ca79a693086)
Signed-off-by: Matthew Weigel <Matthew.Weigel@freescale.com>
Conflicts:
drivers/crypto/caam/ctrl.c
Change-Id: I3c2ec1c34215b5d2a1ee036809beaeabf724ac48
Reviewed-on: http://git.am.freescale.net:8181/24179
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Matthew Weigel <Matthew.Weigel@freescale.com>
-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; } /* |