All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 12:10 ` Christophe JAILLET
  0 siblings, 0 replies; 10+ messages in thread
From: Christophe JAILLET @ 2017-02-26 12:10 UTC (permalink / raw)
  To: robdclark-Re5JQEeQqe8AvxtiuMwx3w, airlied-cv59FeDIM0c,
	architt-sgV2jX0FEOL9JmXXK+q4OQ, hali-sgV2jX0FEOL9JmXXK+q4OQ,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Christophe JAILLET,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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.

Count forward in order to fix it and be more future proof.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: change the for loop from a backward to a forward one, to ease reading.
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 1fc07ce24686..e6f56cd8ce08 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
 static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
 {
 	const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
-	int i, ret;
+	int i, j, ret;
 
 	DBG("id=%d", msm_host->id);
 
@@ -437,8 +437,8 @@ 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]);
+	for (j = 0; j < i; j++)
+		clk_disable_unprepare(msm_host->bus_clks[j]);
 
 	return ret;
 }
-- 
2.9.3


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

* [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 12:10 ` Christophe JAILLET
  0 siblings, 0 replies; 10+ messages in thread
From: Christophe JAILLET @ 2017-02-26 12:10 UTC (permalink / raw)
  To: robdclark-Re5JQEeQqe8AvxtiuMwx3w, airlied-cv59FeDIM0c,
	architt-sgV2jX0FEOL9JmXXK+q4OQ, hali-sgV2jX0FEOL9JmXXK+q4OQ,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Christophe JAILLET,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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.

Count forward in order to fix it and be more future proof.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: change the for loop from a backward to a forward one, to ease reading.
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 1fc07ce24686..e6f56cd8ce08 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
 static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
 {
 	const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
-	int i, ret;
+	int i, j, ret;
 
 	DBG("id=%d", msm_host->id);
 
@@ -437,8 +437,8 @@ 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]);
+	for (j = 0; j < i; j++)
+		clk_disable_unprepare(msm_host->bus_clks[j]);
 
 	return ret;
 }
-- 
2.9.3

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 12:10 ` Christophe JAILLET
  0 siblings, 0 replies; 10+ messages in thread
From: Christophe JAILLET @ 2017-02-26 12:10 UTC (permalink / raw)
  To: robdclark, airlied, architt, hali, yongjun_wei
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel,
	kernel-janitors, 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.

Count forward in order to fix it and be more future proof.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: change the for loop from a backward to a forward one, to ease reading.
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 1fc07ce24686..e6f56cd8ce08 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
 static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
 {
 	const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
-	int i, ret;
+	int i, j, ret;
 
 	DBG("id=%d", msm_host->id);
 
@@ -437,8 +437,8 @@ 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]);
+	for (j = 0; j < i; j++)
+		clk_disable_unprepare(msm_host->bus_clks[j]);
 
 	return ret;
 }
-- 
2.9.3

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

* Re: [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
       [not found] ` <20170226121057.9717-1-christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
  2017-02-26 14:28     ` walter harms
@ 2017-02-26 14:28     ` walter harms
  1 sibling, 0 replies; 10+ messages in thread
From: walter harms @ 2017-02-26 14:28 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	architt-sgV2jX0FEOL9JmXXK+q4OQ, airlied-cv59FeDIM0c,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, hali-sgV2jX0FEOL9JmXXK+q4OQ

looks good to me.

Reviewed-by: wharms@bfs.de

Am 26.02.2017 13:10, 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.
> 
> Count forward in order to fix it and be more future proof.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: change the for loop from a backward to a forward one, to ease reading.
> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..e6f56cd8ce08 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
>  static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  {
>  	const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
> -	int i, ret;
> +	int i, j, ret;
>  
>  	DBG("id=%d", msm_host->id);
>  
> @@ -437,8 +437,8 @@ 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]);
> +	for (j = 0; j < i; j++)
> +		clk_disable_unprepare(msm_host->bus_clks[j]);
>  
>  	return ret;
>  }

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

* Re: [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 14:28     ` walter harms
  0 siblings, 0 replies; 10+ messages in thread
From: walter harms @ 2017-02-26 14:28 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	architt-sgV2jX0FEOL9JmXXK+q4OQ, airlied-cv59FeDIM0c,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, hali-sgV2jX0FEOL9JmXXK+q4OQ

looks good to me.

Reviewed-by: wharms@bfs.de

Am 26.02.2017 13:10, 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.
> 
> Count forward in order to fix it and be more future proof.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: change the for loop from a backward to a forward one, to ease reading.
> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..e6f56cd8ce08 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
>  static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  {
>  	const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
> -	int i, ret;
> +	int i, j, ret;
>  
>  	DBG("id=%d", msm_host->id);
>  
> @@ -437,8 +437,8 @@ 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]);
> +	for (j = 0; j < i; j++)
> +		clk_disable_unprepare(msm_host->bus_clks[j]);
>  
>  	return ret;
>  }
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* Re: [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 14:28     ` walter harms
  0 siblings, 0 replies; 10+ messages in thread
From: walter harms @ 2017-02-26 14:28 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: robdclark, airlied, architt, hali, yongjun_wei, linux-arm-msm,
	dri-devel, freedreno, linux-kernel, kernel-janitors

looks good to me.

Reviewed-by: wharms@bfs.de

Am 26.02.2017 13:10, 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.
> 
> Count forward in order to fix it and be more future proof.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: change the for loop from a backward to a forward one, to ease reading.
> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..e6f56cd8ce08 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
>  static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  {
>  	const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
> -	int i, ret;
> +	int i, j, ret;
>  
>  	DBG("id=%d", msm_host->id);
>  
> @@ -437,8 +437,8 @@ 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]);
> +	for (j = 0; j < i; j++)
> +		clk_disable_unprepare(msm_host->bus_clks[j]);
>  
>  	return ret;
>  }

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

* Re: [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
       [not found] ` <20170226121057.9717-1-christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
  2017-02-26 14:28     ` walter harms
@ 2017-02-26 15:25     ` Rob Clark
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Clark @ 2017-02-26 15:25 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Archit Taneja,
	David Airlie, linux-arm-msm,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Linux Kernel Mailing List,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Wei Yongjun, Hai Li

On Sun, Feb 26, 2017 at 7:10 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.
>
> Count forward in order to fix it and be more future proof.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: change the for loop from a backward to a forward one, to ease reading.

fwiw, I prefer your v1, for reasons discussed on a similar patch
fixing the same issue:

https://lists.freedesktop.org/archives/dri-devel/2017-February/133097.html

(although your v1 is a better solution than the original, since we
probably don't want to clk_disable_unprepare() the clk that failed to
enable.)

BR,
-R

> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..e6f56cd8ce08 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
>  static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  {
>         const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
> -       int i, ret;
> +       int i, j, ret;
>
>         DBG("id=%d", msm_host->id);
>
> @@ -437,8 +437,8 @@ 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]);
> +       for (j = 0; j < i; j++)
> +               clk_disable_unprepare(msm_host->bus_clks[j]);
>
>         return ret;
>  }
> --
> 2.9.3
>

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

* Re: [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 15:25     ` Rob Clark
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Clark @ 2017-02-26 15:25 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Archit Taneja,
	David Airlie, linux-arm-msm,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Linux Kernel Mailing List,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Wei Yongjun, Hai Li

On Sun, Feb 26, 2017 at 7:10 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.
>
> Count forward in order to fix it and be more future proof.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: change the for loop from a backward to a forward one, to ease reading.

fwiw, I prefer your v1, for reasons discussed on a similar patch
fixing the same issue:

https://lists.freedesktop.org/archives/dri-devel/2017-February/133097.html

(although your v1 is a better solution than the original, since we
probably don't want to clk_disable_unprepare() the clk that failed to
enable.)

BR,
-R

> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..e6f56cd8ce08 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
>  static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  {
>         const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
> -       int i, ret;
> +       int i, j, ret;
>
>         DBG("id=%d", msm_host->id);
>
> @@ -437,8 +437,8 @@ 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]);
> +       for (j = 0; j < i; j++)
> +               clk_disable_unprepare(msm_host->bus_clks[j]);
>
>         return ret;
>  }
> --
> 2.9.3
>
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* Re: [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 15:25     ` Rob Clark
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Clark @ 2017-02-26 15:25 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: David Airlie, Archit Taneja, Hai Li, Wei Yongjun, linux-arm-msm,
	dri-devel@lists.freedesktop.org, freedreno,
	Linux Kernel Mailing List, kernel-janitors

On Sun, Feb 26, 2017 at 7:10 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.
>
> Count forward in order to fix it and be more future proof.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: change the for loop from a backward to a forward one, to ease reading.

fwiw, I prefer your v1, for reasons discussed on a similar patch
fixing the same issue:

https://lists.freedesktop.org/archives/dri-devel/2017-February/133097.html

(although your v1 is a better solution than the original, since we
probably don't want to clk_disable_unprepare() the clk that failed to
enable.)

BR,
-R

> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..e6f56cd8ce08 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -422,7 +422,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
>  static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  {
>         const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
> -       int i, ret;
> +       int i, j, ret;
>
>         DBG("id=%d", msm_host->id);
>
> @@ -437,8 +437,8 @@ 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]);
> +       for (j = 0; j < i; j++)
> +               clk_disable_unprepare(msm_host->bus_clks[j]);
>
>         return ret;
>  }
> --
> 2.9.3
>

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

* Re: [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
  2017-02-26 12:10 ` Christophe JAILLET
                   ` (2 preceding siblings ...)
  (?)
@ 2017-02-26 19:39 ` Christophe JAILLET
  -1 siblings, 0 replies; 10+ messages in thread
From: Christophe JAILLET @ 2017-02-26 19:39 UTC (permalink / raw)
  To: kernel-janitors

Le 26/02/2017 à 16:25, Rob Clark a écrit :
> On Sun, Feb 26, 2017 at 7:10 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.
>>
>> Count forward in order to fix it and be more future proof.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> v2: change the for loop from a backward to a forward one, to ease reading.
> fwiw, I prefer your v1, for reasons discussed on a similar patch
> fixing the same issue:
>
> https://lists.freedesktop.org/archives/dri-devel/2017-February/133097.html
>
> (although your v1 is a better solution than the original, since we
> probably don't want to clk_disable_unprepare() the clk that failed to
> enable.)
>
> BR,
> -R
Argh, 2 times in the same week that I post something already proposed by 
Dan.
Sorry for the noise. I should be more careful.

Thanks for the link and for explanation.

Best regards,
CJ


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

end of thread, other threads:[~2017-02-26 19:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-26 12:10 [PATCH v2] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()' Christophe JAILLET
2017-02-26 12:10 ` Christophe JAILLET
2017-02-26 12:10 ` Christophe JAILLET
     [not found] ` <20170226121057.9717-1-christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
2017-02-26 14:28   ` walter harms
2017-02-26 14:28     ` walter harms
2017-02-26 14:28     ` walter harms
2017-02-26 15:25   ` Rob Clark
2017-02-26 15:25     ` Rob Clark
2017-02-26 15:25     ` Rob Clark
2017-02-26 19:39 ` Christophe JAILLET

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.