Re: [PATCH] drm/i915: release struct_mutex on the i915_gem_init_hw fail path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jani,

On Fri, Dec 05, 2014 at 02:17:42PM +0200, Jani Nikula wrote:
> Release struct_mutex if init_rings() fails.
> 
> This is a regression introduced in
> commit 35a57ffbb10840af219eeaf64718434242bb7c76
> Author: Daniel Vetter <daniel.vetter@xxxxxxxx>
> Date:   Thu Nov 20 00:33:07 2014 +0100
> 
>     drm/i915: Only init engines once
> 
> Reported-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index c1c11418231b..e3ce4bef22a3 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4860,22 +4860,18 @@ int i915_gem_init(struct drm_device *dev)
>  	}
>  
>  	ret = i915_gem_init_userptr(dev);
> -	if (ret) {
> -		mutex_unlock(&dev->struct_mutex);
> -		return ret;
> -	}
> +	if (ret)
> +		goto out_unlock;
>  
>  	i915_gem_init_global_gtt(dev);
>  
>  	ret = i915_gem_context_init(dev);
> -	if (ret) {
> -		mutex_unlock(&dev->struct_mutex);
> -		return ret;
> -	}
> +	if (ret)
> +		goto out_unlock;
>  
>  	ret = dev_priv->gt.init_rings(dev);
>  	if (ret)
> -		return ret;
> +		goto out_unlock;
>  
>  	ret = i915_gem_init_hw(dev);
>  	if (ret == -EIO) {
> @@ -4887,6 +4883,8 @@ int i915_gem_init(struct drm_device *dev)
>  		atomic_set_mask(I915_WEDGED, &dev_priv->gpu_error.reset_counter);
>  		ret = 0;
>  	}
> +
> +out_unlock:
>  	mutex_unlock(&dev->struct_mutex);
>  
>  	return ret;
> -- 
> 2.1.3
> 

Yes, this looks much better.

-- 
- Jeremiah Mahler
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux