提交 1257e0f8 编写于 作者: C Chris Wilson

drm/i915/selftests: Fix error path for ggtt walk_hole()

The patch 6e32ab3d: "drm/i915: Fill different pages of the GTT"
from Feb 13, 2017, leads to the following static checker warning:

        drivers/gpu/drm/i915/selftests/i915_gem_gtt.c:583 walk_hole()
        error: 'vma' dereferencing possible ERR_PTR()
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Fixes: 6e32ab3d ("drm/i915: Fill different pages of the GTT"
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170313100750.2685-1-chris@chris-wilson.co.ukReviewed-by: NMatthew Auld <matthew.auld@intel.com>
上级 7f5f95d8
...@@ -539,7 +539,7 @@ static int walk_hole(struct drm_i915_private *i915, ...@@ -539,7 +539,7 @@ static int walk_hole(struct drm_i915_private *i915,
vma = i915_vma_instance(obj, vm, NULL); vma = i915_vma_instance(obj, vm, NULL);
if (IS_ERR(vma)) { if (IS_ERR(vma)) {
err = PTR_ERR(vma); err = PTR_ERR(vma);
goto err; goto err_put;
} }
for (addr = hole_start; for (addr = hole_start;
...@@ -550,7 +550,7 @@ static int walk_hole(struct drm_i915_private *i915, ...@@ -550,7 +550,7 @@ static int walk_hole(struct drm_i915_private *i915,
pr_err("%s bind failed at %llx + %llx [hole %llx- %llx] with err=%d\n", pr_err("%s bind failed at %llx + %llx [hole %llx- %llx] with err=%d\n",
__func__, addr, vma->size, __func__, addr, vma->size,
hole_start, hole_end, err); hole_start, hole_end, err);
goto err; goto err_close;
} }
i915_vma_unpin(vma); i915_vma_unpin(vma);
...@@ -559,14 +559,14 @@ static int walk_hole(struct drm_i915_private *i915, ...@@ -559,14 +559,14 @@ static int walk_hole(struct drm_i915_private *i915,
pr_err("%s incorrect at %llx + %llx\n", pr_err("%s incorrect at %llx + %llx\n",
__func__, addr, vma->size); __func__, addr, vma->size);
err = -EINVAL; err = -EINVAL;
goto err; goto err_close;
} }
err = i915_vma_unbind(vma); err = i915_vma_unbind(vma);
if (err) { if (err) {
pr_err("%s unbind failed at %llx + %llx with err=%d\n", pr_err("%s unbind failed at %llx + %llx with err=%d\n",
__func__, addr, vma->size, err); __func__, addr, vma->size, err);
goto err; goto err_close;
} }
GEM_BUG_ON(drm_mm_node_allocated(&vma->node)); GEM_BUG_ON(drm_mm_node_allocated(&vma->node));
...@@ -575,13 +575,14 @@ static int walk_hole(struct drm_i915_private *i915, ...@@ -575,13 +575,14 @@ static int walk_hole(struct drm_i915_private *i915,
"%s timed out at %llx\n", "%s timed out at %llx\n",
__func__, addr)) { __func__, addr)) {
err = -EINTR; err = -EINTR;
goto err; goto err_close;
} }
} }
err: err_close:
if (!i915_vma_is_ggtt(vma)) if (!i915_vma_is_ggtt(vma))
i915_vma_close(vma); i915_vma_close(vma);
err_put:
i915_gem_object_put(obj); i915_gem_object_put(obj);
if (err) if (err)
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册