[Intel-gfx] [PATCH] drm/i915/overlay: Fix unpinning along init error paths

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 28 18:32:14 CEST 2011


On Tue, 28 Jun 2011 08:57:14 -0700, Ben Widawsky <ben at bwidawsk.net> wrote:
> > diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
> > index cffd3ed..d360380 100644
> > --- a/drivers/gpu/drm/i915/intel_overlay.c
> > +++ b/drivers/gpu/drm/i915/intel_overlay.c
> > @@ -1405,6 +1405,11 @@ void intel_setup_overlay(struct drm_device *dev)
> >  	overlay = kzalloc(sizeof(struct intel_overlay), GFP_KERNEL);
> >  	if (!overlay)
> >  		return;
> > +
> > +	mutex_lock(&dev->struct_mutex);
> > +	if (WARN_ON(dev_priv->overlay))
> > +		goto out_free;
> > +
> >  	overlay->dev = dev;
> >  
> >  	reg_bo = i915_gem_alloc_object(dev, PAGE_SIZE);
> 
> For my curiosity, was there a reason you chose to acquire the lock after
> the kzalloc?

I was just trying to keep the error paths as simple as possible. Overtime,
we probably want to lift the mutex out of this function and higher into
the init paths for simplicity.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list