Commit 7bcc3777 authored by Jani Nikula's avatar Jani Nikula Committed by Daniel Vetter

drm/i915: release struct_mutex on the i915_gem_init_hw fail path

Release struct_mutex if init_rings() fails.

This is a regression introduced in
commit 35a57ffb
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Nov 20 00:33:07 2014 +0100

    drm/i915: Only init engines once
Reported-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 8f4d2683
...@@ -4860,22 +4860,18 @@ int i915_gem_init(struct drm_device *dev) ...@@ -4860,22 +4860,18 @@ int i915_gem_init(struct drm_device *dev)
} }
ret = i915_gem_init_userptr(dev); ret = i915_gem_init_userptr(dev);
if (ret) { if (ret)
mutex_unlock(&dev->struct_mutex); goto out_unlock;
return ret;
}
i915_gem_init_global_gtt(dev); i915_gem_init_global_gtt(dev);
ret = i915_gem_context_init(dev); ret = i915_gem_context_init(dev);
if (ret) { if (ret)
mutex_unlock(&dev->struct_mutex); goto out_unlock;
return ret;
}
ret = dev_priv->gt.init_rings(dev); ret = dev_priv->gt.init_rings(dev);
if (ret) if (ret)
return ret; goto out_unlock;
ret = i915_gem_init_hw(dev); ret = i915_gem_init_hw(dev);
if (ret == -EIO) { if (ret == -EIO) {
...@@ -4887,6 +4883,8 @@ int i915_gem_init(struct drm_device *dev) ...@@ -4887,6 +4883,8 @@ int i915_gem_init(struct drm_device *dev)
atomic_set_mask(I915_WEDGED, &dev_priv->gpu_error.reset_counter); atomic_set_mask(I915_WEDGED, &dev_priv->gpu_error.reset_counter);
ret = 0; ret = 0;
} }
out_unlock:
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment