Message ID | 20190304090321.47638-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1,1/2] drm/selftests/mm: Switch to bitmap_zalloc() | expand |
I take it that both instances are supposed to call bitmap_zalloc? If you can send a v2 that compiles, I can merge it after it passes the CI. Regards, Joonas Quoting Andy Shevchenko (2019-03-04 11:03:20) > 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> > --- > drivers/gpu/drm/selftests/test-drm_mm.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c > index fbed2c90fd51..d1206aef26af 100644 > --- a/drivers/gpu/drm/selftests/test-drm_mm.c > +++ b/drivers/gpu/drm/selftests/test-drm_mm.c > @@ -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; > @@ -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; > > @@ -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: > @@ -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_zcalloc(count, GFP_KERNEL); > if (!bitmap) > goto err_nodes; > > @@ -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: > -- > 2.20.1 >
On Tue, Mar 05, 2019 at 11:28:36AM +0200, Joonas Lahtinen wrote: > I take it that both instances are supposed to call bitmap_zalloc? > > If you can send a v2 that compiles, I can merge it after it passes the > CI. v2 had been sent yesterday.
Quoting Andy Shevchenko (2019-03-05 10:20:31) > On Tue, Mar 05, 2019 at 11:28:36AM +0200, Joonas Lahtinen wrote: > > I take it that both instances are supposed to call bitmap_zalloc? > > > > If you can send a v2 that compiles, I can merge it after it passes the > > CI. > > v2 had been sent yesterday. https://patchwork.freedesktop.org/series/57507/ -Chris
diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c index fbed2c90fd51..d1206aef26af 100644 --- a/drivers/gpu/drm/selftests/test-drm_mm.c +++ b/drivers/gpu/drm/selftests/test-drm_mm.c @@ -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; @@ -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; @@ -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: @@ -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_zcalloc(count, GFP_KERNEL); if (!bitmap) goto err_nodes; @@ -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:
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> --- drivers/gpu/drm/selftests/test-drm_mm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)