[Intel-gfx] [PATCH] drm/i915: Free resources correctly if we cannot map status page during ctx create

Daniel Vetter daniel at ffwll.ch
Tue Nov 18 09:05:08 CET 2014


On Tue, Nov 18, 2014 at 07:44:40AM +0000, Chris Wilson wrote:
> On Mon, Nov 17, 2014 at 08:04:09PM +0100, Daniel Vetter wrote:
> > On Mon, Nov 17, 2014 at 03:48:27PM +0000, Arun Siluvery wrote:
> > > We are not freeing memory allocated for ringbuf and ctx if we fail
> > > to map status page so release all resources correctly.
> > > 
> > > Signed-off-by: Arun Siluvery <arun.siluvery at linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_lrc.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> > > index f3efdbd..a84d24b 100644
> > > --- a/drivers/gpu/drm/i915/intel_lrc.c
> > > +++ b/drivers/gpu/drm/i915/intel_lrc.c
> > > @@ -1777,8 +1777,10 @@ int intel_lr_context_deferred_create(struct intel_context *ctx,
> > >  		ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(ctx_obj);
> > >  		ring->status_page.page_addr =
> > >  				kmap(sg_page(ctx_obj->pages->sgl));
> > > -		if (ring->status_page.page_addr == NULL)
> > > -			return -ENOMEM;
> > > +		if (ring->status_page.page_addr == NULL) {
> > > +			ret = -ENOMEM;
> > > +			goto error;
> > > +		}
> > 
> > Since this popped up: Do we have an automated igt testcase to exercise
> > this corner-case?
> 
> How? kmap() never returns NULL.

Oh dear.

/me hangs head in shame

I'll do a patch to correct this.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list