From: Jeremiah Mahler <jmmahler@gmail.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, weiyj_lk@163.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/i915: release struct_mutex on the i915_gem_init_hw fail path
Date: Fri, 5 Dec 2014 05:03:14 -0800 [thread overview]
Message-ID: <20141205130314.GA2658@hudson.localdomain> (raw)
In-Reply-To: <1417781862-23368-2-git-send-email-jani.nikula@intel.com>
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@ffwll.ch>
> Date: Thu Nov 20 00:33:07 2014 +0100
>
> drm/i915: Only init engines once
>
> Reported-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> 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
next prev parent reply other threads:[~2014-12-05 13:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 0:55 [PATCH -next] drm/i915: Fix missing unlock on error in i915_gem_init_hw() weiyj_lk
2014-12-05 1:39 ` Jeremiah Mahler
2014-12-05 12:17 ` Jani Nikula
2014-12-05 12:17 ` Jani Nikula
2014-12-05 12:17 ` [PATCH] drm/i915: release struct_mutex on the i915_gem_init_hw fail path Jani Nikula
2014-12-05 13:03 ` Jeremiah Mahler [this message]
2014-12-05 14:04 ` [Intel-gfx] " Daniel Vetter
2014-12-05 13:21 ` [Intel-gfx] [PATCH -next] drm/i915: Fix missing unlock on error in i915_gem_init_hw() Daniel Vetter
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=20141205130314.GA2658@hudson.localdomain \
--to=jmmahler@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=weiyj_lk@163.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