[Intel-gfx] [PATCH 1/3] drm/i915: buddy allocator

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 9 21:36:46 UTC 2019


Quoting Matthew Auld (2019-08-09 21:29:24)
> +int i915_buddy_alloc_range(struct i915_buddy_mm *mm,
> +                          struct list_head *blocks,
> +                          u64 start, u64 size)
> +{
> +       struct i915_buddy_block *block;
> +       struct i915_buddy_block *buddy;
> +       LIST_HEAD(allocated);
> +       LIST_HEAD(dfs);
> +       u64 end;
> +       int err;
> +       int i;
> +
> +       if (size < mm->chunk_size)
> +               return -EINVAL;
> +
> +       if (!IS_ALIGNED(start, mm->chunk_size))
> +               return -EINVAL;
> +
> +       if (!size || !IS_ALIGNED(size, mm->chunk_size))
> +               return -EINVAL;

chunk_size can't be 0 and size can't be less than chunk_size, ergo size
is non-zero.

if (!IS_ALIGNED(start | size, mm->chunk_size))
	return -EINVAL;

My last brain cell dies happy,
-Chris


More information about the Intel-gfx mailing list