remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 14 Mar 2018 19:56:37 +0000 (20:56 +0100)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Sun, 18 Mar 2018 22:43:46 +0000 (15:43 -0700)
If 'of_device_get_match_data()' fails, we must undo the previous
'rproc_alloc()' call.

Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/imx_rproc.c

index 633268e9d550de7001999052f2692239b4754f6b..05bcbce2013a98d8e34210ce6cde7bddbdc76c58 100644 (file)
@@ -339,8 +339,10 @@ static int imx_rproc_probe(struct platform_device *pdev)
        }
 
        dcfg = of_device_get_match_data(dev);
-       if (!dcfg)
-               return -EINVAL;
+       if (!dcfg) {
+               ret = -EINVAL;
+               goto err_put_rproc;
+       }
 
        priv = rproc->priv;
        priv->rproc = rproc;