Commit 8b78f0e5 authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

drm/i915: Clarify relocation errnos

While trying to find a random -EINVAL from a failing test, I noticed we
had a few hard to follow return values.

The first two hunks in this patch replace completely useless
initialization of ret. The last several hunks help to distinguish
between altering 'return ret' and 'return <ERROR>'
Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent c3d19d3c
...@@ -252,7 +252,7 @@ relocate_entry_cpu(struct drm_i915_gem_object *obj, ...@@ -252,7 +252,7 @@ relocate_entry_cpu(struct drm_i915_gem_object *obj,
struct drm_device *dev = obj->base.dev; struct drm_device *dev = obj->base.dev;
uint32_t page_offset = offset_in_page(reloc->offset); uint32_t page_offset = offset_in_page(reloc->offset);
char *vaddr; char *vaddr;
int ret = -EINVAL; int ret;
ret = i915_gem_object_set_to_cpu_domain(obj, true); ret = i915_gem_object_set_to_cpu_domain(obj, true);
if (ret) if (ret)
...@@ -287,7 +287,7 @@ relocate_entry_gtt(struct drm_i915_gem_object *obj, ...@@ -287,7 +287,7 @@ relocate_entry_gtt(struct drm_i915_gem_object *obj,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t __iomem *reloc_entry; uint32_t __iomem *reloc_entry;
void __iomem *reloc_page; void __iomem *reloc_page;
int ret = -EINVAL; int ret;
ret = i915_gem_object_set_to_gtt_domain(obj, true); ret = i915_gem_object_set_to_gtt_domain(obj, true);
if (ret) if (ret)
...@@ -335,7 +335,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, ...@@ -335,7 +335,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
struct drm_i915_gem_object *target_i915_obj; struct drm_i915_gem_object *target_i915_obj;
struct i915_vma *target_vma; struct i915_vma *target_vma;
uint32_t target_offset; uint32_t target_offset;
int ret = -EINVAL; int ret;
/* we've already hold a reference to all valid objects */ /* we've already hold a reference to all valid objects */
target_vma = eb_get_vma(eb, reloc->target_handle); target_vma = eb_get_vma(eb, reloc->target_handle);
...@@ -365,7 +365,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, ...@@ -365,7 +365,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
(int) reloc->offset, (int) reloc->offset,
reloc->read_domains, reloc->read_domains,
reloc->write_domain); reloc->write_domain);
return ret; return -EINVAL;
} }
if (unlikely((reloc->write_domain | reloc->read_domains) if (unlikely((reloc->write_domain | reloc->read_domains)
& ~I915_GEM_GPU_DOMAINS)) { & ~I915_GEM_GPU_DOMAINS)) {
...@@ -376,7 +376,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, ...@@ -376,7 +376,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
(int) reloc->offset, (int) reloc->offset,
reloc->read_domains, reloc->read_domains,
reloc->write_domain); reloc->write_domain);
return ret; return -EINVAL;
} }
target_obj->pending_read_domains |= reloc->read_domains; target_obj->pending_read_domains |= reloc->read_domains;
...@@ -396,14 +396,14 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, ...@@ -396,14 +396,14 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
obj, reloc->target_handle, obj, reloc->target_handle,
(int) reloc->offset, (int) reloc->offset,
(int) obj->base.size); (int) obj->base.size);
return ret; return -EINVAL;
} }
if (unlikely(reloc->offset & 3)) { if (unlikely(reloc->offset & 3)) {
DRM_DEBUG("Relocation not 4-byte aligned: " DRM_DEBUG("Relocation not 4-byte aligned: "
"obj %p target %d offset %d.\n", "obj %p target %d offset %d.\n",
obj, reloc->target_handle, obj, reloc->target_handle,
(int) reloc->offset); (int) reloc->offset);
return ret; return -EINVAL;
} }
/* We can't wait for rendering with pagefaults disabled */ /* We can't wait for rendering with pagefaults disabled */
......
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