public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Matthew Auld <matthew.auld@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: BUG_ON when ggtt_view is NULL
Date: Tue, 29 Mar 2016 13:46:03 +0200	[thread overview]
Message-ID: <20160329114603.GT2510@phenom.ffwll.local> (raw)
In-Reply-To: <1458834860-7898-1-git-send-email-matthew.auld@intel.com>

On Thu, Mar 24, 2016 at 03:54:20PM +0000, Matthew Auld wrote:
> Lets BUG_ON and don't bother with a WARN and returning an error, so we can
> remove the need to pollute the code with error handling, after all it is
> a programmer error to provide NULL view. Also while we're here remove
> redundant NULL ggtt_view check.
> 
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>

Yeah, seems to have sprawled too much for not much gain. BUG_ON approved
;-)

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_gem.c     |  9 ++-------
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 10 +---------
>  2 files changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index c7a997a..cbf616a 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4235,9 +4235,6 @@ i915_gem_object_do_pin(struct drm_i915_gem_object *obj,
>  	vma = ggtt_view ? i915_gem_obj_to_ggtt_view(obj, ggtt_view) :
>  			  i915_gem_obj_to_vma(obj, vm);
>  
> -	if (IS_ERR(vma))
> -		return PTR_ERR(vma);
> -
>  	if (vma) {
>  		if (WARN_ON(vma->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT))
>  			return -EBUSY;
> @@ -4300,8 +4297,7 @@ i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
>  			 uint32_t alignment,
>  			 uint64_t flags)
>  {
> -	if (WARN_ONCE(!view, "no view specified"))
> -		return -EINVAL;
> +	BUG_ON(!view);
>  
>  	return i915_gem_object_do_pin(obj, i915_obj_to_ggtt(obj), view,
>  				      alignment, flags | PIN_GLOBAL);
> @@ -4618,8 +4614,7 @@ struct i915_vma *i915_gem_obj_to_ggtt_view(struct drm_i915_gem_object *obj,
>  	struct i915_address_space *ggtt = i915_obj_to_ggtt(obj);
>  	struct i915_vma *vma;
>  
> -	if (WARN_ONCE(!view, "no view specified"))
> -		return ERR_PTR(-EINVAL);
> +	BUG_ON(!view);
>  
>  	list_for_each_entry(vma, &obj->vma_list, obj_link)
>  		if (vma->vm == ggtt &&
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 7cfafdc..073c6bb 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3341,15 +3341,7 @@ i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj,
>  				       const struct i915_ggtt_view *view)
>  {
>  	struct i915_address_space *ggtt = i915_obj_to_ggtt(obj);
> -	struct i915_vma *vma;
> -
> -	if (WARN_ON(!view))
> -		return ERR_PTR(-EINVAL);
> -
> -	vma = i915_gem_obj_to_ggtt_view(obj, view);
> -
> -	if (IS_ERR(vma))
> -		return vma;
> +	struct i915_vma *vma = i915_gem_obj_to_ggtt_view(obj, view);
>  
>  	if (!vma)
>  		vma = __i915_gem_vma_create(obj, ggtt, view);
> -- 
> 2.4.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-03-29 11:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 15:54 [PATCH] drm/i915: BUG_ON when ggtt_view is NULL Matthew Auld
2016-03-25  7:01 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-03-29 11:46 ` Daniel Vetter [this message]
2016-03-30 10:02 ` [PATCH] " Joonas Lahtinen

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=20160329114603.GT2510@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.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