Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1588294 > unrolled thread

[PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-02-26 09:00 +0100
Last post2017-02-26 14:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-02-26 09:00 +0100
    Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error  path in 'dsi_bus_clk_enable()' walter harms <wharms@bfs.de> - 2017-02-26 10:10 +0100
    Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path  in 'dsi_bus_clk_enable()' Rob Clark <robdclark@gmail.com> - 2017-02-26 14:10 +0100

#1588294 — [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-02-26 09:00 +0100
Subject[PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
Message-ID<tf1Um-3Gs-5@gated-at.bofh.it>
If a 'clk_prepare_enable()' fails, then we need to disable_unprepare the
clk already handled.

With the current implemenatation, we try to do that on the clk that has
triggered the error, which is a no-op, and leave 'msm_host->bus_clks[0]'
untouched.

Shift by one the index array to free resources correctly.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 1fc07ce24686..eac4987f3946 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -438,7 +438,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
 	return 0;
 err:
 	for (; i > 0; i--)
-		clk_disable_unprepare(msm_host->bus_clks[i]);
+		clk_disable_unprepare(msm_host->bus_clks[i-1]);
 
 	return ret;
 }
-- 
2.9.3

[toc] | [next] | [standalone]


#1588305 — Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'

Fromwalter harms <wharms@bfs.de>
Date2017-02-26 10:10 +0100
SubjectRe: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
Message-ID<tf305-4Dn-5@gated-at.bofh.it>
In reply to#1588294

Am 26.02.2017 08:52, schrieb Christophe JAILLET:
> If a 'clk_prepare_enable()' fails, then we need to disable_unprepare the
> clk already handled.
> 
> With the current implemenatation, we try to do that on the clk that has
> triggered the error, which is a no-op, and leave 'msm_host->bus_clks[0]'
> untouched.
> 
> Shift by one the index array to free resources correctly.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..eac4987f3946 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -438,7 +438,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  	return 0;
>  err:
>  	for (; i > 0; i--)
> -		clk_disable_unprepare(msm_host->bus_clks[i]);
> +		clk_disable_unprepare(msm_host->bus_clks[i-1]);
>  
>  	return ret;
>  }

i guess it is technical correct but programmes are
very bad at counting backwards so its more future proof to
do something like:

for (j=0;j<i;j++)
	clk_disable_unprepare(msm_host->bus_clks[j]);

re,
 wh

[toc] | [prev] | [next] | [standalone]


#1588323 — Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'

FromRob Clark <robdclark@gmail.com>
Date2017-02-26 14:10 +0100
SubjectRe: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
Message-ID<tf6Kl-7ci-7@gated-at.bofh.it>
In reply to#1588294
On Sun, Feb 26, 2017 at 2:52 AM, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
> If a 'clk_prepare_enable()' fails, then we need to disable_unprepare the
> clk already handled.
>
> With the current implemenatation, we try to do that on the clk that has
> triggered the error, which is a no-op, and leave 'msm_host->bus_clks[0]'
> untouched.
>
> Shift by one the index array to free resources correctly.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Rob Clark <robdclark@gmail.com>

> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..eac4987f3946 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -438,7 +438,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>         return 0;
>  err:
>         for (; i > 0; i--)
> -               clk_disable_unprepare(msm_host->bus_clks[i]);
> +               clk_disable_unprepare(msm_host->bus_clks[i-1]);
>
>         return ret;
>  }
> --
> 2.9.3
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web