Skip to content

Commit

Permalink
drm/selftests/mm: Switch to bitmap_zalloc()
Browse files Browse the repository at this point in the history
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190304092908.57382-1-andriy.shevchenko@linux.intel.com
  • Loading branch information
Andy Shevchenko authored and Chris Wilson committed Mar 20, 2019
1 parent a89bfc5 commit 34965a5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/gpu/drm/selftests/test-drm_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ static int igt_topdown(void *ignored)
DRM_RND_STATE(prng, random_seed);
const unsigned int count = 8192;
unsigned int size;
unsigned long *bitmap = NULL;
unsigned long *bitmap;
struct drm_mm mm;
struct drm_mm_node *nodes, *node, *next;
unsigned int *order, n, m, o = 0;
Expand All @@ -1631,8 +1631,7 @@ static int igt_topdown(void *ignored)
if (!nodes)
goto err;

bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long),
GFP_KERNEL);
bitmap = bitmap_zalloc(count, GFP_KERNEL);
if (!bitmap)
goto err_nodes;

Expand Down Expand Up @@ -1717,7 +1716,7 @@ static int igt_topdown(void *ignored)
drm_mm_takedown(&mm);
kfree(order);
err_bitmap:
kfree(bitmap);
bitmap_free(bitmap);
err_nodes:
vfree(nodes);
err:
Expand Down Expand Up @@ -1745,8 +1744,7 @@ static int igt_bottomup(void *ignored)
if (!nodes)
goto err;

bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long),
GFP_KERNEL);
bitmap = bitmap_zalloc(count, GFP_KERNEL);
if (!bitmap)
goto err_nodes;

Expand Down Expand Up @@ -1818,7 +1816,7 @@ static int igt_bottomup(void *ignored)
drm_mm_takedown(&mm);
kfree(order);
err_bitmap:
kfree(bitmap);
bitmap_free(bitmap);
err_nodes:
vfree(nodes);
err:
Expand Down

0 comments on commit 34965a5

Please sign in to comment.