Commit 6e514e37 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Chris Wilson

drm/i915: Switch to bitmap_zalloc()

Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190304092908.57382-2-andriy.shevchenko@linux.intel.com
parent 8cac9fd9
...@@ -4195,7 +4195,7 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915, ...@@ -4195,7 +4195,7 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
drm_gem_object_release(&obj->base); drm_gem_object_release(&obj->base);
i915_gem_info_remove_obj(i915, obj->base.size); i915_gem_info_remove_obj(i915, obj->base.size);
kfree(obj->bit_17); bitmap_free(obj->bit_17);
i915_gem_object_free(obj); i915_gem_object_free(obj);
GEM_BUG_ON(!atomic_read(&i915->mm.free_count)); GEM_BUG_ON(!atomic_read(&i915->mm.free_count));
......
...@@ -765,8 +765,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj, ...@@ -765,8 +765,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj,
int i; int i;
if (obj->bit_17 == NULL) { if (obj->bit_17 == NULL) {
obj->bit_17 = kcalloc(BITS_TO_LONGS(page_count), obj->bit_17 = bitmap_zalloc(page_count, GFP_KERNEL);
sizeof(long), GFP_KERNEL);
if (obj->bit_17 == NULL) { if (obj->bit_17 == NULL) {
DRM_ERROR("Failed to allocate memory for bit 17 " DRM_ERROR("Failed to allocate memory for bit 17 "
"record\n"); "record\n");
......
...@@ -301,11 +301,11 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, ...@@ -301,11 +301,11 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
/* Try to preallocate memory required to save swizzling on put-pages */ /* Try to preallocate memory required to save swizzling on put-pages */
if (i915_gem_object_needs_bit17_swizzle(obj)) { if (i915_gem_object_needs_bit17_swizzle(obj)) {
if (!obj->bit_17) { if (!obj->bit_17) {
obj->bit_17 = kcalloc(BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT), obj->bit_17 = bitmap_zalloc(obj->base.size >> PAGE_SHIFT,
sizeof(long), GFP_KERNEL); GFP_KERNEL);
} }
} else { } else {
kfree(obj->bit_17); bitmap_free(obj->bit_17);
obj->bit_17 = NULL; obj->bit_17 = NULL;
} }
......
...@@ -258,8 +258,7 @@ static int live_forcewake_domains(void *arg) ...@@ -258,8 +258,7 @@ static int live_forcewake_domains(void *arg)
if (!IS_ENABLED(CONFIG_DRM_I915_SELFTEST_BROKEN)) if (!IS_ENABLED(CONFIG_DRM_I915_SELFTEST_BROKEN))
return 0; return 0;
valid = kcalloc(BITS_TO_LONGS(FW_RANGE), sizeof(*valid), valid = bitmap_zalloc(FW_RANGE, GFP_KERNEL);
GFP_KERNEL);
if (!valid) if (!valid)
return -ENOMEM; return -ENOMEM;
...@@ -294,7 +293,7 @@ static int live_forcewake_domains(void *arg) ...@@ -294,7 +293,7 @@ static int live_forcewake_domains(void *arg)
} }
} }
kfree(valid); bitmap_free(valid);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment