diff mbox series

[1/2] drm/i915/buddy: tidy up i915_buddy_fini

Message ID 20190816105357.14340-1-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/buddy: tidy up i915_buddy_fini | expand

Commit Message

Matthew Auld Aug. 16, 2019, 10:53 a.m. UTC
If we are leaking nodes don't hide it. Also stop trying to be
"defensive" and instead embrace Kasan et al.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_buddy.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Chris Wilson Aug. 16, 2019, 10:56 a.m. UTC | #1
Quoting Matthew Auld (2019-08-16 11:53:56)
> If we are leaking nodes don't hide it. Also stop trying to be
> "defensive" and instead embrace Kasan et al.
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_buddy.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_buddy.c b/drivers/gpu/drm/i915/i915_buddy.c
> index b679ab6fd889..5995247fdf76 100644
> --- a/drivers/gpu/drm/i915/i915_buddy.c
> +++ b/drivers/gpu/drm/i915/i915_buddy.c
> @@ -171,15 +171,10 @@ int i915_buddy_init(struct i915_buddy_mm *mm, u64 size, u64 chunk_size)
>  
>  void i915_buddy_fini(struct i915_buddy_mm *mm)
>  {
> -       int err = 0;
>         int i;
>  
>         for (i = 0; i < mm->n_roots; ++i) {
> -               if (!i915_buddy_block_is_free(mm->roots[i])) {
> -                       err = -EBUSY;
> -                       continue;
> -               }
> -
> +               GEM_WARN_ON(!i915_buddy_block_is_free(mm->roots[i]));

Gut feeling says once, or only for debug, and we need something other
than a GEM debug prefix here.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_buddy.c b/drivers/gpu/drm/i915/i915_buddy.c
index b679ab6fd889..5995247fdf76 100644
--- a/drivers/gpu/drm/i915/i915_buddy.c
+++ b/drivers/gpu/drm/i915/i915_buddy.c
@@ -171,15 +171,10 @@  int i915_buddy_init(struct i915_buddy_mm *mm, u64 size, u64 chunk_size)
 
 void i915_buddy_fini(struct i915_buddy_mm *mm)
 {
-	int err = 0;
 	int i;
 
 	for (i = 0; i < mm->n_roots; ++i) {
-		if (!i915_buddy_block_is_free(mm->roots[i])) {
-			err = -EBUSY;
-			continue;
-		}
-
+		GEM_WARN_ON(!i915_buddy_block_is_free(mm->roots[i]));
 		i915_block_free(mm->roots[i]);
 	}