public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	kernel-janitors@vger.kernel.org, yongjun_wei@trendmicro.com.cn,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/msm/dsi: Fix the releasing of resources in error path in 'dsi_bus_clk_enable()'
Date: Sun, 26 Feb 2017 09:03:06 +0000	[thread overview]
Message-ID: <58B299CA.4060203@bfs.de> (raw)
In-Reply-To: <20170226075206.25762-1-christophe.jaillet@wanadoo.fr>



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





  reply	other threads:[~2017-02-26  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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  9:03 ` walter harms [this message]
     [not found] ` <20170226075206.25762-1-christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
2017-02-26 13:03   ` Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58B299CA.4060203@bfs.de \
    --to=wharms@bfs.de \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yongjun_wei@trendmicro.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox