Re: [PATCH] [trivial] drm/i915: Clarify relocation errnos

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

 



2013/12/26 Ben Widawsky <benjamin.widawsky@xxxxxxxxx>:
> 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>'

I agree, the new code is much easier to read.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>

>
> Signed-off-by: Ben Widawsky <ben@xxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index bbff8f9..0383171 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -267,7 +267,7 @@ relocate_entry_cpu(struct drm_i915_gem_object *obj,
>         struct drm_device *dev = obj->base.dev;
>         uint32_t page_offset = offset_in_page(reloc->offset);
>         char *vaddr;
> -       int ret = -EINVAL;
> +       int ret;
>
>         ret = i915_gem_object_set_to_cpu_domain(obj, true);
>         if (ret)
> @@ -302,7 +302,7 @@ relocate_entry_gtt(struct drm_i915_gem_object *obj,
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         uint32_t __iomem *reloc_entry;
>         void __iomem *reloc_page;
> -       int ret = -EINVAL;
> +       int ret;
>
>         ret = i915_gem_object_set_to_gtt_domain(obj, true);
>         if (ret)
> @@ -349,7 +349,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
>         struct drm_i915_gem_object *target_i915_obj;
>         struct i915_vma *target_vma;
>         uint32_t target_offset;
> -       int ret = -EINVAL;
> +       int ret;
>
>         /* we've already hold a reference to all valid objects */
>         target_vma = eb_get_vma(eb, reloc->target_handle);
> @@ -381,7 +381,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
>                           (int) reloc->offset,
>                           reloc->read_domains,
>                           reloc->write_domain);
> -               return ret;
> +               return -EINVAL;
>         }
>         if (unlikely((reloc->write_domain | reloc->read_domains)
>                      & ~I915_GEM_GPU_DOMAINS)) {
> @@ -392,7 +392,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
>                           (int) reloc->offset,
>                           reloc->read_domains,
>                           reloc->write_domain);
> -               return ret;
> +               return -EINVAL;
>         }
>
>         target_obj->pending_read_domains |= reloc->read_domains;
> @@ -412,14 +412,14 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
>                           obj, reloc->target_handle,
>                           (int) reloc->offset,
>                           (int) obj->base.size);
> -               return ret;
> +               return -EINVAL;
>         }
>         if (unlikely(reloc->offset & 3)) {
>                 DRM_DEBUG("Relocation not 4-byte aligned: "
>                           "obj %p target %d offset %d.\n",
>                           obj, reloc->target_handle,
>                           (int) reloc->offset);
> -               return ret;
> +               return -EINVAL;
>         }
>
>         /* We can't wait for rendering with pagefaults disabled */
> --
> 1.8.5.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni
_______________________________________________
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