remoteproc: imx_rproc: Re-use existing error handling path in 'imx_rproc_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 14 Mar 2018 19:56:38 +0000 (20:56 +0100)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Sun, 18 Mar 2018 22:43:46 +0000 (15:43 -0700)
Avoid some code ducplication and be more future-proof.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/imx_rproc.c

index 05bcbce2013a98d8e34210ce6cde7bddbdc76c58..6d02ef62a626f9ebe84a86a6f82d8d48ede633cb 100644 (file)
@@ -361,8 +361,8 @@ static int imx_rproc_probe(struct platform_device *pdev)
        priv->clk = devm_clk_get(dev, NULL);
        if (IS_ERR(priv->clk)) {
                dev_err(dev, "Failed to get clock\n");
-               rproc_free(rproc);
-               return PTR_ERR(priv->clk);
+               ret = PTR_ERR(priv->clk);
+               goto err_put_rproc;
        }
 
        /*
@@ -372,8 +372,7 @@ static int imx_rproc_probe(struct platform_device *pdev)
        ret = clk_prepare_enable(priv->clk);
        if (ret) {
                dev_err(&rproc->dev, "Failed to enable clock\n");
-               rproc_free(rproc);
-               return ret;
+               goto err_put_rproc;
        }
 
        ret = rproc_add(rproc);