Commit 34965a52 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Chris Wilson

drm/selftests/mm: 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-1-andriy.shevchenko@linux.intel.com
parent a89bfc5d
...@@ -1615,7 +1615,7 @@ static int igt_topdown(void *ignored) ...@@ -1615,7 +1615,7 @@ static int igt_topdown(void *ignored)
DRM_RND_STATE(prng, random_seed); DRM_RND_STATE(prng, random_seed);
const unsigned int count = 8192; const unsigned int count = 8192;
unsigned int size; unsigned int size;
unsigned long *bitmap = NULL; unsigned long *bitmap;
struct drm_mm mm; struct drm_mm mm;
struct drm_mm_node *nodes, *node, *next; struct drm_mm_node *nodes, *node, *next;
unsigned int *order, n, m, o = 0; unsigned int *order, n, m, o = 0;
...@@ -1631,8 +1631,7 @@ static int igt_topdown(void *ignored) ...@@ -1631,8 +1631,7 @@ static int igt_topdown(void *ignored)
if (!nodes) if (!nodes)
goto err; goto err;
bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long), bitmap = bitmap_zalloc(count, GFP_KERNEL);
GFP_KERNEL);
if (!bitmap) if (!bitmap)
goto err_nodes; goto err_nodes;
...@@ -1717,7 +1716,7 @@ static int igt_topdown(void *ignored) ...@@ -1717,7 +1716,7 @@ static int igt_topdown(void *ignored)
drm_mm_takedown(&mm); drm_mm_takedown(&mm);
kfree(order); kfree(order);
err_bitmap: err_bitmap:
kfree(bitmap); bitmap_free(bitmap);
err_nodes: err_nodes:
vfree(nodes); vfree(nodes);
err: err:
...@@ -1745,8 +1744,7 @@ static int igt_bottomup(void *ignored) ...@@ -1745,8 +1744,7 @@ static int igt_bottomup(void *ignored)
if (!nodes) if (!nodes)
goto err; goto err;
bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long), bitmap = bitmap_zalloc(count, GFP_KERNEL);
GFP_KERNEL);
if (!bitmap) if (!bitmap)
goto err_nodes; goto err_nodes;
...@@ -1818,7 +1816,7 @@ static int igt_bottomup(void *ignored) ...@@ -1818,7 +1816,7 @@ static int igt_bottomup(void *ignored)
drm_mm_takedown(&mm); drm_mm_takedown(&mm);
kfree(order); kfree(order);
err_bitmap: err_bitmap:
kfree(bitmap); bitmap_free(bitmap);
err_nodes: err_nodes:
vfree(nodes); vfree(nodes);
err: 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