public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
	Matthew Auld <matthew.auld@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: tidy up gen8_init_scratch
Date: Wed, 27 Apr 2016 16:10:10 +0300	[thread overview]
Message-ID: <1461762610.3986.35.camel@linux.intel.com> (raw)
In-Reply-To: <87y47znsij.fsf@gaia.fi.intel.com>

On ke, 2016-04-27 at 15:30 +0300, Mika Kuoppala wrote:
> Matthew Auld <matthew.auld@intel.com> writes:
> 
> > 
> > [ text/plain ]
> > Prefer a goto teardown path to do all the required cleanup.
> > 
> > v2:
> > (Joonas Lahtinen)
> >   - remove NULL assignments
> >   - rename goto labels
> > 
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > Cc: Dave Gordon <david.s.gordon@intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
> 

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> > 
> > ---
> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 25 ++++++++++++++++---------
> >  1 file changed, 16 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index 0d666b3..87947ec 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -866,6 +866,7 @@ static void gen8_free_page_tables(struct drm_device *dev,
> >  static int gen8_init_scratch(struct i915_address_space *vm)
> >  {
> >  	struct drm_device *dev = vm->dev;
> > +	int ret;
> >  
> >  	vm->scratch_page = alloc_scratch_page(dev);
> >  	if (IS_ERR(vm->scratch_page))
> > @@ -873,24 +874,21 @@ static int gen8_init_scratch(struct i915_address_space *vm)
> >  
> >  	vm->scratch_pt = alloc_pt(dev);
> >  	if (IS_ERR(vm->scratch_pt)) {
> > -		free_scratch_page(dev, vm->scratch_page);
> > -		return PTR_ERR(vm->scratch_pt);
> > +		ret = PTR_ERR(vm->scratch_pt);
> > +		goto free_scratch_page;
> >  	}
> >  
> >  	vm->scratch_pd = alloc_pd(dev);
> >  	if (IS_ERR(vm->scratch_pd)) {
> > -		free_pt(dev, vm->scratch_pt);
> > -		free_scratch_page(dev, vm->scratch_page);
> > -		return PTR_ERR(vm->scratch_pd);
> > +		ret = PTR_ERR(vm->scratch_pd);
> > +		goto free_pt;
> >  	}
> >  
> >  	if (USES_FULL_48BIT_PPGTT(dev)) {
> >  		vm->scratch_pdp = alloc_pdp(dev);
> >  		if (IS_ERR(vm->scratch_pdp)) {
> > -			free_pd(dev, vm->scratch_pd);
> > -			free_pt(dev, vm->scratch_pt);
> > -			free_scratch_page(dev, vm->scratch_page);
> > -			return PTR_ERR(vm->scratch_pdp);
> > +			ret = PTR_ERR(vm->scratch_pdp);
> > +			goto free_pd;
> >  		}
> >  	}
> >  
> > @@ -900,6 +898,15 @@ static int gen8_init_scratch(struct i915_address_space *vm)
> >  		gen8_initialize_pdp(vm, vm->scratch_pdp);
> >  
> >  	return 0;
> > +
> > +free_pd:
> > +	free_pd(dev, vm->scratch_pd);
> > +free_pt:
> > +	free_pt(dev, vm->scratch_pt);
> > +free_scratch_page:
> > +	free_scratch_page(dev, vm->scratch_page);
> > +
> > +	return ret;
> >  }
> >  
> >  static int gen8_ppgtt_notify_vgt(struct i915_hw_ppgtt *ppgtt, bool create)
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-27 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 12:19 [PATCH] drm/i915: tidy up gen8_init_scratch Matthew Auld
2016-04-27 12:30 ` Mika Kuoppala
2016-04-27 13:10   ` Joonas Lahtinen [this message]
2016-04-27 12:49 ` ✗ Fi.CI.BAT: failure for drm/i915: tidy up gen8_init_scratch (rev2) Patchwork
2016-04-27 13:06   ` Mika Kuoppala
2016-04-27 13:14   ` Joonas Lahtinen
  -- strict thread matches above, loose matches on Subject: below --
2016-04-26  9:27 [PATCH] drm/i915: tidy up gen8_init_scratch Matthew Auld
2016-04-27  7:39 ` Joonas Lahtinen
2016-04-27 10:15 ` Dave Gordon
2016-04-27 11:26   ` Mika Kuoppala

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=1461762610.3986.35.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=mika.kuoppala@linux.intel.com \
    /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