diff mbox series

drm/i915: stop checking for NULL vma->obj

Message ID 20220304174252.1000238-1-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: stop checking for NULL vma->obj | expand

Commit Message

Matthew Auld March 4, 2022, 5:42 p.m. UTC
This is no longer possible since e6e1a304d759 ("drm/i915: vma is always
backed by an object.").

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_vma.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Comments

Thomas Hellström March 4, 2022, 5:47 p.m. UTC | #1
On Fri, 2022-03-04 at 17:42 +0000, Matthew Auld wrote:
> This is no longer possible since e6e1a304d759 ("drm/i915: vma is
> always
> backed by an object.").
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>

LGTM. 
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_vma.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_vma.c
> b/drivers/gpu/drm/i915/i915_vma.c
> index 94fcdb7bd21d..7acfbbc63d17 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -515,21 +515,18 @@ int i915_vma_bind(struct i915_vma *vma,
>                 if (!work->vma_res->bi.pages_rsgt)
>                         work->pinned = i915_gem_object_get(vma->obj);
>         } else {
> -               if (vma->obj) {
> -                       ret = i915_gem_object_wait_moving_fence(vma-
> >obj, true);
> -                       if (ret) {
> -                               i915_vma_resource_free(vma-
> >resource);
> -                               vma->resource = NULL;
> +               ret = i915_gem_object_wait_moving_fence(vma->obj,
> true);
> +               if (ret) {
> +                       i915_vma_resource_free(vma->resource);
> +                       vma->resource = NULL;
>  
> -                               return ret;
> -                       }
> +                       return ret;
>                 }
>                 vma->ops->bind_vma(vma->vm, NULL, vma->resource,
> cache_level,
>                                    bind_flags);
>         }
>  
> -       if (vma->obj)
> -               set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
> +       set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
>  
>         atomic_or(bind_flags, &vma->flags);
>         return 0;
> @@ -1360,7 +1357,7 @@ int i915_vma_pin_ww(struct i915_vma *vma,
> struct i915_gem_ww_ctx *ww,
>         if (flags & PIN_GLOBAL)
>                 wakeref = intel_runtime_pm_get(&vma->vm->i915-
> >runtime_pm);
>  
> -       moving = vma->obj ? i915_gem_object_get_moving_fence(vma-
> >obj) : NULL;
> +       moving = i915_gem_object_get_moving_fence(vma->obj);
>         if (flags & vma->vm->bind_async_flags || moving) {
>                 /* lock VM */
>                 err = i915_vm_lock_objects(vma->vm, ww);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 94fcdb7bd21d..7acfbbc63d17 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -515,21 +515,18 @@  int i915_vma_bind(struct i915_vma *vma,
 		if (!work->vma_res->bi.pages_rsgt)
 			work->pinned = i915_gem_object_get(vma->obj);
 	} else {
-		if (vma->obj) {
-			ret = i915_gem_object_wait_moving_fence(vma->obj, true);
-			if (ret) {
-				i915_vma_resource_free(vma->resource);
-				vma->resource = NULL;
+		ret = i915_gem_object_wait_moving_fence(vma->obj, true);
+		if (ret) {
+			i915_vma_resource_free(vma->resource);
+			vma->resource = NULL;
 
-				return ret;
-			}
+			return ret;
 		}
 		vma->ops->bind_vma(vma->vm, NULL, vma->resource, cache_level,
 				   bind_flags);
 	}
 
-	if (vma->obj)
-		set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
+	set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
 
 	atomic_or(bind_flags, &vma->flags);
 	return 0;
@@ -1360,7 +1357,7 @@  int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
 	if (flags & PIN_GLOBAL)
 		wakeref = intel_runtime_pm_get(&vma->vm->i915->runtime_pm);
 
-	moving = vma->obj ? i915_gem_object_get_moving_fence(vma->obj) : NULL;
+	moving = i915_gem_object_get_moving_fence(vma->obj);
 	if (flags & vma->vm->bind_async_flags || moving) {
 		/* lock VM */
 		err = i915_vm_lock_objects(vma->vm, ww);