All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26  7:52 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2017-02-26  7:52 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.

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

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

* [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26  7:52 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2017-02-26  7:52 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.

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


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

* Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
  2017-02-26  7:52 ` Christophe JAILLET
  (?)
@ 2017-02-26  9:03   ` walter harms
  -1 siblings, 0 replies; 8+ messages in thread
From: walter harms @ 2017-02-26  9:03 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: freedreno, linux-arm-msm, kernel-janitors, yongjun_wei,
	dri-devel, linux-kernel



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




_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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



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

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

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



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





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

* Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
  2017-02-26  7:52 ` Christophe JAILLET
  (?)
@ 2017-02-26 13:03     ` Rob Clark
  -1 siblings, 0 replies; 8+ messages in thread
From: Rob Clark @ 2017-02-26 13:03 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, Wei Yongjun, Hai Li

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
>
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

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

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
>

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

* Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
@ 2017-02-26 13:03     ` Rob Clark
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Clark @ 2017-02-26 13:03 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, Wei Yongjun, Hai Li

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
>

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-26  7:52 [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()' Christophe JAILLET
2017-02-26  7:52 ` Christophe JAILLET
2017-02-26  9:03 ` walter harms
2017-02-26  9:03   ` walter harms
2017-02-26  9:03   ` walter harms
     [not found] ` <20170226075206.25762-1-christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
2017-02-26 13:03   ` Rob Clark
2017-02-26 13:03     ` Rob Clark
2017-02-26 13:03     ` Rob Clark

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.