All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jani Nikula <jani.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Archit Taneja <architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Wei Yongjun
	<yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [patch] drm/msm/dsi: free first element on error
Date: Thu, 16 Feb 2017 11:53:07 +0000	[thread overview]
Message-ID: <20170216115307.GD4108@mwanda> (raw)
In-Reply-To: <87a89mnznw.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Thu, Feb 16, 2017 at 01:27:47PM +0200, Jani Nikula wrote:
> 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.
> 

Ah yeah.  You're right.  I'll resend.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Jani Nikula <jani.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Archit Taneja <architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Wei Yongjun
	<yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [patch] drm/msm/dsi: free first element on error
Date: Thu, 16 Feb 2017 14:53:07 +0300	[thread overview]
Message-ID: <20170216115307.GD4108@mwanda> (raw)
In-Reply-To: <87a89mnznw.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Thu, Feb 16, 2017 at 01:27:47PM +0200, Jani Nikula wrote:
> 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.
> 

Ah yeah.  You're right.  I'll resend.

regards,
dan carpenter

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

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

Thread overview: 26+ 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 10:50 ` Dan Carpenter
2017-02-16 11:27 ` Jani Nikula
2017-02-16 11:27   ` Jani Nikula
     [not found]   ` <87a89mnznw.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-02-16 11:53     ` Dan Carpenter [this message]
2017-02-16 11:53       ` Dan Carpenter
2017-02-16 12:03       ` walter harms
2017-02-16 12:03         ` walter harms
2017-02-16 12:15         ` Rob Clark
2017-02-16 12:15           ` Rob Clark
2017-02-16 12:25         ` Jani Nikula
2017-02-16 12:25           ` Jani Nikula
2017-02-16 12:00   ` [patch v2] " Dan Carpenter
2017-02-16 12:00     ` Dan Carpenter
2017-02-16 12:16     ` Rob Clark
2017-02-16 12:16       ` Rob Clark
2017-02-16 12:27       ` Jani Nikula
2017-02-16 12:27         ` Jani Nikula
2017-02-26 20:52         ` Daniel Vetter
2017-02-26 20:52           ` Daniel Vetter
2017-02-27 10:18           ` Jani Nikula
2017-02-27 10:18             ` Jani Nikula
     [not found]             ` <87h93ggcnn.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-02-27 10:25               ` Daniel Vetter
2017-02-27 10:25                 ` Daniel Vetter
     [not found]                 ` <CAKMK7uGLn3m8eEzYEmPFDPr090B0Cq9Xycg_bJdX7SkRJYtNyg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-27 11:25                   ` Rob Clark
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=20170216115307.GD4108@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=jani.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org \
    /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 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.