kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Rob Clark <robdclark@gmail.com>,
	Archit Taneja <architt@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org,
	Wei Yongjun <yongjun_wei@trendmicro.com.cn>,
	freedreno@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [patch] drm/msm/dsi: free first element on error
Date: Thu, 16 Feb 2017 11:27:47 +0000	[thread overview]
Message-ID: <87a89mnznw.fsf@intel.com> (raw)
In-Reply-To: <20170216105042.GA25544@mwanda>

On Thu, 16 Feb 2017, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We want to free msm_host->bus_clks[0] so the > should be >=.
>
> Fixes: 6e0eb52eba9e ("drm/msm/dsi: Parse bus clocks from a list")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 1fc07ce24686..239e79b39a45 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -437,7 +437,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
>  
>  	return 0;
>  err:
> -	for (; i > 0; i--)
> +	for (; i >= 0; i--)
>  		clk_disable_unprepare(msm_host->bus_clks[i]);

By the looks of it this is also wrong. I didn't look at the functions,
but you probably don't want to unprepare something where prepare failed,
i.e. you want to -1 both the start and end offsets. Perhaps the right
fix is

	while (i--)
		clk_disable_unprepare(msm_host->bus_clks[i]);

which also seems to be widely used on error paths.

BR,
Jani.


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

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2017-02-16 11:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 10:50 [patch] drm/msm/dsi: free first element on error Dan Carpenter
2017-02-16 11:27 ` Jani Nikula [this message]
     [not found]   ` <87a89mnznw.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-02-16 11:53     ` Dan Carpenter
2017-02-16 12:03       ` walter harms
2017-02-16 12:15         ` Rob Clark
2017-02-16 12:25         ` Jani Nikula
2017-02-16 12:00   ` [patch v2] " Dan Carpenter
2017-02-16 12:16     ` Rob Clark
2017-02-16 12:27       ` Jani Nikula
2017-02-26 20:52         ` Daniel Vetter
2017-02-27 10:18           ` Jani Nikula
     [not found]             ` <87h93ggcnn.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-02-27 10:25               ` Daniel Vetter
     [not found]                 ` <CAKMK7uGLn3m8eEzYEmPFDPr090B0Cq9Xycg_bJdX7SkRJYtNyg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-27 11:25                   ` 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=87a89mnznw.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=architt@codeaurora.org \
    --cc=dan.carpenter@oracle.com \
    --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=robdclark@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).