Thread (5 messages) 5 messages, 2 authors, 2015-08-21

Re: [PATCH v2 1/3] crypto: caam: ctrl: Fix the error handling

From: Fabio Estevam <festevam@gmail.com>
Date: 2015-08-21 16:43:17

On Fri, Aug 21, 2015 at 1:16 PM, Fabio Estevam [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Fabio Estevam <redacted>

In the error path we should disable the resources that were previously
acquired, so fix the error handling accordingly.

Signed-off-by: Fabio Estevam <redacted>
---
Changes since v1:
- None

 drivers/crypto/caam/ctrl.c | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 81b552d..9c5ca46 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -474,27 +474,27 @@ static int caam_probe(struct platform_device *pdev)
        ret = clk_prepare_enable(ctrlpriv->caam_ipg);
        if (ret < 0) {
                dev_err(&pdev->dev, "can't enable CAAM ipg clock: %d\n", ret);
-               return -ENODEV;
+               return ret;
        }

        ret = clk_prepare_enable(ctrlpriv->caam_mem);
        if (ret < 0) {
                dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n",
                        ret);
-               return -ENODEV;
+               goto disable_caam_ipg;
        }

        ret = clk_prepare_enable(ctrlpriv->caam_aclk);
        if (ret < 0) {
                dev_err(&pdev->dev, "can't enable CAAM aclk clock: %d\n", ret);
-               return -ENODEV;
+               goto disable_caam_mem;
        }

        ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
        if (ret < 0) {
                dev_err(&pdev->dev, "can't enable CAAM emi slow clock: %d\n",
                        ret);
-               return -ENODEV;
+               goto disable_caam_aclk;
        }

        /* Get configuration properties from device tree */
@@ -502,7 +502,7 @@ static int caam_probe(struct platform_device *pdev)
        ctrl = of_iomap(nprop, 0);
        if (ctrl == NULL) {
                dev_err(dev, "caam: of_iomap() failed\n");
-               return -ENOMEM;
+               goto disable_caam_emi_slow;
Ops, I missed a 'ret = -ENOMEM' here.

Will send a v3.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help