All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: mtk-sd: Fix missing clk_disable_unprepare in msdc_of_clock_parse()
@ 2022-11-25  9:01 ` Gaosheng Cui
  0 siblings, 0 replies; 4+ messages in thread
From: Gaosheng Cui @ 2022-11-25  9:01 UTC (permalink / raw)
  To: chaotian.jing, ulf.hansson, matthias.bgg, drinkcat, wenbin.mei,
	cuigaosheng1
  Cc: linux-mmc, linux-arm-kernel, linux-mediatek

The clk_disable_unprepare() should be called in the error handling
of devm_clk_bulk_get_optional, fix it by replacing devm_clk_get_optional
and clk_prepare_enable by devm_clk_get_optional_enabled.

Fixes: f5eccd94b63f ("mmc: mediatek: Add subsys clock control for MT8192 msdc")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/mmc/host/mtk-sd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 0f06cc5fec86..abadfc319053 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2605,13 +2605,11 @@ static int msdc_of_clock_parse(struct platform_device *pdev,
 			return PTR_ERR(host->src_clk_cg);
 	}
 
-	host->sys_clk_cg = devm_clk_get_optional(&pdev->dev, "sys_cg");
+	/* If present, always enable for this clock gate */
+	host->sys_clk_cg = devm_clk_get_optional_enabled(&pdev->dev, "sys_cg");
 	if (IS_ERR(host->sys_clk_cg))
 		host->sys_clk_cg = NULL;
 
-	/* If present, always enable for this clock gate */
-	clk_prepare_enable(host->sys_clk_cg);
-
 	host->bulk_clks[0].id = "pclk_cg";
 	host->bulk_clks[1].id = "axi_cg";
 	host->bulk_clks[2].id = "ahb_cg";
-- 
2.25.1


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

* [PATCH] mmc: mtk-sd: Fix missing clk_disable_unprepare in msdc_of_clock_parse()
@ 2022-11-25  9:01 ` Gaosheng Cui
  0 siblings, 0 replies; 4+ messages in thread
From: Gaosheng Cui @ 2022-11-25  9:01 UTC (permalink / raw)
  To: chaotian.jing, ulf.hansson, matthias.bgg, drinkcat, wenbin.mei,
	cuigaosheng1
  Cc: linux-mmc, linux-arm-kernel, linux-mediatek

The clk_disable_unprepare() should be called in the error handling
of devm_clk_bulk_get_optional, fix it by replacing devm_clk_get_optional
and clk_prepare_enable by devm_clk_get_optional_enabled.

Fixes: f5eccd94b63f ("mmc: mediatek: Add subsys clock control for MT8192 msdc")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/mmc/host/mtk-sd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 0f06cc5fec86..abadfc319053 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2605,13 +2605,11 @@ static int msdc_of_clock_parse(struct platform_device *pdev,
 			return PTR_ERR(host->src_clk_cg);
 	}
 
-	host->sys_clk_cg = devm_clk_get_optional(&pdev->dev, "sys_cg");
+	/* If present, always enable for this clock gate */
+	host->sys_clk_cg = devm_clk_get_optional_enabled(&pdev->dev, "sys_cg");
 	if (IS_ERR(host->sys_clk_cg))
 		host->sys_clk_cg = NULL;
 
-	/* If present, always enable for this clock gate */
-	clk_prepare_enable(host->sys_clk_cg);
-
 	host->bulk_clks[0].id = "pclk_cg";
 	host->bulk_clks[1].id = "axi_cg";
 	host->bulk_clks[2].id = "ahb_cg";
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mmc: mtk-sd: Fix missing clk_disable_unprepare in msdc_of_clock_parse()
  2022-11-25  9:01 ` Gaosheng Cui
@ 2022-11-29 12:54   ` Ulf Hansson
  -1 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2022-11-29 12:54 UTC (permalink / raw)
  To: Gaosheng Cui
  Cc: chaotian.jing, matthias.bgg, drinkcat, wenbin.mei, linux-mmc,
	linux-arm-kernel, linux-mediatek

On Fri, 25 Nov 2022 at 10:01, Gaosheng Cui <cuigaosheng1@huawei.com> wrote:
>
> The clk_disable_unprepare() should be called in the error handling
> of devm_clk_bulk_get_optional, fix it by replacing devm_clk_get_optional
> and clk_prepare_enable by devm_clk_get_optional_enabled.
>
> Fixes: f5eccd94b63f ("mmc: mediatek: Add subsys clock control for MT8192 msdc")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/mtk-sd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 0f06cc5fec86..abadfc319053 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -2605,13 +2605,11 @@ static int msdc_of_clock_parse(struct platform_device *pdev,
>                         return PTR_ERR(host->src_clk_cg);
>         }
>
> -       host->sys_clk_cg = devm_clk_get_optional(&pdev->dev, "sys_cg");
> +       /* If present, always enable for this clock gate */
> +       host->sys_clk_cg = devm_clk_get_optional_enabled(&pdev->dev, "sys_cg");
>         if (IS_ERR(host->sys_clk_cg))
>                 host->sys_clk_cg = NULL;
>
> -       /* If present, always enable for this clock gate */
> -       clk_prepare_enable(host->sys_clk_cg);
> -
>         host->bulk_clks[0].id = "pclk_cg";
>         host->bulk_clks[1].id = "axi_cg";
>         host->bulk_clks[2].id = "ahb_cg";
> --
> 2.25.1
>

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

* Re: [PATCH] mmc: mtk-sd: Fix missing clk_disable_unprepare in msdc_of_clock_parse()
@ 2022-11-29 12:54   ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2022-11-29 12:54 UTC (permalink / raw)
  To: Gaosheng Cui
  Cc: chaotian.jing, matthias.bgg, drinkcat, wenbin.mei, linux-mmc,
	linux-arm-kernel, linux-mediatek

On Fri, 25 Nov 2022 at 10:01, Gaosheng Cui <cuigaosheng1@huawei.com> wrote:
>
> The clk_disable_unprepare() should be called in the error handling
> of devm_clk_bulk_get_optional, fix it by replacing devm_clk_get_optional
> and clk_prepare_enable by devm_clk_get_optional_enabled.
>
> Fixes: f5eccd94b63f ("mmc: mediatek: Add subsys clock control for MT8192 msdc")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/mtk-sd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 0f06cc5fec86..abadfc319053 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -2605,13 +2605,11 @@ static int msdc_of_clock_parse(struct platform_device *pdev,
>                         return PTR_ERR(host->src_clk_cg);
>         }
>
> -       host->sys_clk_cg = devm_clk_get_optional(&pdev->dev, "sys_cg");
> +       /* If present, always enable for this clock gate */
> +       host->sys_clk_cg = devm_clk_get_optional_enabled(&pdev->dev, "sys_cg");
>         if (IS_ERR(host->sys_clk_cg))
>                 host->sys_clk_cg = NULL;
>
> -       /* If present, always enable for this clock gate */
> -       clk_prepare_enable(host->sys_clk_cg);
> -
>         host->bulk_clks[0].id = "pclk_cg";
>         host->bulk_clks[1].id = "axi_cg";
>         host->bulk_clks[2].id = "ahb_cg";
> --
> 2.25.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-11-29 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25  9:01 [PATCH] mmc: mtk-sd: Fix missing clk_disable_unprepare in msdc_of_clock_parse() Gaosheng Cui
2022-11-25  9:01 ` Gaosheng Cui
2022-11-29 12:54 ` Ulf Hansson
2022-11-29 12:54   ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.