]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mailbox: imx: Disable the clock on devm_mbox_controller_register() failure
authorFabio Estevam <festevam@gmail.com>
Sat, 30 May 2020 22:56:28 +0000 (17:56 -0500)
committerJassi Brar <jaswinder.singh@linaro.org>
Sat, 30 May 2020 22:58:39 +0000 (17:58 -0500)
devm_mbox_controller_register() may fail, and in the case of failure the
priv->clk clock that was previously enabled, should be disabled.

Fixes: 367077bc4a69 ("mailbox: Add support for i.MX messaging unit")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
[Jassi: fixed merge/am conflict]
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/imx-mailbox.c

index cacc60662f24c0d3952b0cb3735c876827ad36ac..19f8d79cebac07e8f7197322949abad82682e220 100644 (file)
@@ -513,8 +513,10 @@ static int imx_mu_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, priv);
 
        ret = devm_mbox_controller_register(dev, &priv->mbox);
-       if (ret)
+       if (ret) {
+               clk_disable_unprepare(priv->clk);
                return ret;
+       }
 
        pm_runtime_enable(dev);