* [PATCH] mailbox: imx: Disable the clock on devm_mbox_controller_register() failure
@ 2020-05-20 3:22 Fabio Estevam
2020-05-20 3:27 ` Peng Fan
2020-05-20 4:52 ` Oleksij Rempel
0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2020-05-20 3:22 UTC (permalink / raw)
To: jassisinghbrar; +Cc: kernel, o.rempel, linux-imx, linux-kernel, Fabio Estevam
devm_mbox_controller_register() may fail, and in the case of failure the
priv->clk clock that was previously enabled, should be disabled.
Fixes: 2bb7005696e2 ("mailbox: Add support for i.MX messaging unit")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
drivers/mailbox/imx-mailbox.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index 7906624a731c..3f7c4548c18f 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -508,7 +508,13 @@ static int imx_mu_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
- return devm_mbox_controller_register(dev, &priv->mbox);
+ ret = devm_mbox_controller_register(dev, &priv->mbox);
+ if (ret) {
+ clk_disable_unprepare(priv->clk);
+ return ret;
+ }
+
+ return 0;
}
static int imx_mu_remove(struct platform_device *pdev)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] mailbox: imx: Disable the clock on devm_mbox_controller_register() failure
2020-05-20 3:22 [PATCH] mailbox: imx: Disable the clock on devm_mbox_controller_register() failure Fabio Estevam
@ 2020-05-20 3:27 ` Peng Fan
2020-05-20 4:52 ` Oleksij Rempel
1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan @ 2020-05-20 3:27 UTC (permalink / raw)
To: Fabio Estevam, jassisinghbrar
Cc: kernel, o.rempel, dl-linux-imx, linux-kernel
> Subject: [PATCH] mailbox: imx: Disable the clock on
> devm_mbox_controller_register() failure
>
> devm_mbox_controller_register() may fail, and in the case of failure the
> priv->clk clock that was previously enabled, should be disabled.
>
> Fixes: 2bb7005696e2 ("mailbox: Add support for i.MX messaging unit")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/mailbox/imx-mailbox.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
> index 7906624a731c..3f7c4548c18f 100644
> --- a/drivers/mailbox/imx-mailbox.c
> +++ b/drivers/mailbox/imx-mailbox.c
> @@ -508,7 +508,13 @@ static int imx_mu_probe(struct platform_device
> *pdev)
>
> platform_set_drvdata(pdev, priv);
>
> - return devm_mbox_controller_register(dev, &priv->mbox);
> + ret = devm_mbox_controller_register(dev, &priv->mbox);
> + if (ret) {
> + clk_disable_unprepare(priv->clk);
> + return ret;
> + }
> +
> + return 0;
> }
>
> static int imx_mu_remove(struct platform_device *pdev)
> --
> 2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mailbox: imx: Disable the clock on devm_mbox_controller_register() failure
2020-05-20 3:22 [PATCH] mailbox: imx: Disable the clock on devm_mbox_controller_register() failure Fabio Estevam
2020-05-20 3:27 ` Peng Fan
@ 2020-05-20 4:52 ` Oleksij Rempel
1 sibling, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2020-05-20 4:52 UTC (permalink / raw)
To: Fabio Estevam; +Cc: jassisinghbrar, kernel, linux-imx, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
On Wed, May 20, 2020 at 12:22:46AM -0300, Fabio Estevam wrote:
> devm_mbox_controller_register() may fail, and in the case of failure the
> priv->clk clock that was previously enabled, should be disabled.
>
> Fixes: 2bb7005696e2 ("mailbox: Add support for i.MX messaging unit")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/mailbox/imx-mailbox.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
> index 7906624a731c..3f7c4548c18f 100644
> --- a/drivers/mailbox/imx-mailbox.c
> +++ b/drivers/mailbox/imx-mailbox.c
> @@ -508,7 +508,13 @@ static int imx_mu_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, priv);
>
> - return devm_mbox_controller_register(dev, &priv->mbox);
> + ret = devm_mbox_controller_register(dev, &priv->mbox);
> + if (ret) {
> + clk_disable_unprepare(priv->clk);
> + return ret;
> + }
> +
> + return 0;
> }
>
> static int imx_mu_remove(struct platform_device *pdev)
> --
> 2.17.1
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-20 4:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 3:22 [PATCH] mailbox: imx: Disable the clock on devm_mbox_controller_register() failure Fabio Estevam
2020-05-20 3:27 ` Peng Fan
2020-05-20 4:52 ` Oleksij Rempel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®