LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next v2] soc: aspeed-lpc-ctrl: Fix missing clk_disable_unprepare() on error in aspeed_lpc_ctrl_probe()
@ 2021-08-24  8:55 Yang Yingliang
  2021-08-25  0:07 ` Joel Stanley
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-08-24  8:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-aspeed, joel, andrew

Move syscon_regmap_lookup_by_compatible() above the
devm_clk_get() to avoid missing clk_disable_unprepare().

Fixes: 2f9b25fa6682 ("soc: aspeed: Re-enable FWH2AHB on AST2600")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/soc/aspeed/aspeed-lpc-ctrl.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
index 6893c5ec3259..72771e018c42 100644
--- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c
+++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
@@ -295,6 +295,16 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	if (of_device_is_compatible(dev->of_node, "aspeed,ast2600-lpc-ctrl")) {
+		lpc_ctrl->fwh2ahb = true;
+
+		lpc_ctrl->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2600-scu");
+		if (IS_ERR(lpc_ctrl->scu)) {
+			dev_err(dev, "couldn't find scu\n");
+			return PTR_ERR(lpc_ctrl->scu);
+		}
+	}
+
 	lpc_ctrl->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(lpc_ctrl->clk)) {
 		dev_err(dev, "couldn't get clock\n");
@@ -306,16 +316,6 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	if (of_device_is_compatible(dev->of_node, "aspeed,ast2600-lpc-ctrl")) {
-		lpc_ctrl->fwh2ahb = true;
-
-		lpc_ctrl->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2600-scu");
-		if (IS_ERR(lpc_ctrl->scu)) {
-			dev_err(dev, "couldn't find scu\n");
-			return PTR_ERR(lpc_ctrl->scu);
-		}
-	}
-
 	lpc_ctrl->miscdev.minor = MISC_DYNAMIC_MINOR;
 	lpc_ctrl->miscdev.name = DEVICE_NAME;
 	lpc_ctrl->miscdev.fops = &aspeed_lpc_ctrl_fops;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next v2] soc: aspeed-lpc-ctrl: Fix missing clk_disable_unprepare() on error in aspeed_lpc_ctrl_probe()
  2021-08-24  8:55 [PATCH -next v2] soc: aspeed-lpc-ctrl: Fix missing clk_disable_unprepare() on error in aspeed_lpc_ctrl_probe() Yang Yingliang
@ 2021-08-25  0:07 ` Joel Stanley
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Stanley @ 2021-08-25  0:07 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: Linux Kernel Mailing List, linux-aspeed, Andrew Jeffery

On Tue, 24 Aug 2021 at 08:49, Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> Move syscon_regmap_lookup_by_compatible() above the
> devm_clk_get() to avoid missing clk_disable_unprepare().
>
> Fixes: 2f9b25fa6682 ("soc: aspeed: Re-enable FWH2AHB on AST2600")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Joel Stanley <joel@jms.id.au>

Thanks for the patch. I will send it to the soc maintainers for merging.

> ---
>  drivers/soc/aspeed/aspeed-lpc-ctrl.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
> index 6893c5ec3259..72771e018c42 100644
> --- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c
> +++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
> @@ -295,6 +295,16 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
>                 return -ENODEV;
>         }
>
> +       if (of_device_is_compatible(dev->of_node, "aspeed,ast2600-lpc-ctrl")) {
> +               lpc_ctrl->fwh2ahb = true;
> +
> +               lpc_ctrl->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2600-scu");
> +               if (IS_ERR(lpc_ctrl->scu)) {
> +                       dev_err(dev, "couldn't find scu\n");
> +                       return PTR_ERR(lpc_ctrl->scu);
> +               }
> +       }
> +
>         lpc_ctrl->clk = devm_clk_get(dev, NULL);
>         if (IS_ERR(lpc_ctrl->clk)) {
>                 dev_err(dev, "couldn't get clock\n");
> @@ -306,16 +316,6 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
>                 return rc;
>         }
>
> -       if (of_device_is_compatible(dev->of_node, "aspeed,ast2600-lpc-ctrl")) {
> -               lpc_ctrl->fwh2ahb = true;
> -
> -               lpc_ctrl->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2600-scu");
> -               if (IS_ERR(lpc_ctrl->scu)) {
> -                       dev_err(dev, "couldn't find scu\n");
> -                       return PTR_ERR(lpc_ctrl->scu);
> -               }
> -       }
> -
>         lpc_ctrl->miscdev.minor = MISC_DYNAMIC_MINOR;
>         lpc_ctrl->miscdev.name = DEVICE_NAME;
>         lpc_ctrl->miscdev.fops = &aspeed_lpc_ctrl_fops;
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-25  0:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  8:55 [PATCH -next v2] soc: aspeed-lpc-ctrl: Fix missing clk_disable_unprepare() on error in aspeed_lpc_ctrl_probe() Yang Yingliang
2021-08-25  0:07 ` Joel Stanley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).