[<prev] [next>] [day] [month] [year] [list]
Message-Id: <fdc12cbbb573482ce5a4f344b3a31bc9b6ef2ec1.1657309035.git.christophe.jaillet@wanadoo.fr>
Date: Fri, 8 Jul 2022 21:37:25 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Emma Anholt <emma@...olt.net>, Maxime Ripard <mripard@...nel.org>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
dri-devel@...ts.freedesktop.org
Subject: [PATCH] drm/vc4: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
It is less verbose and it improves the semantic.
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/gpu/drm/vc4/vc4_validate_shaders.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c
index e315aeb5fef5..d074d2014be4 100644
--- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c
+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c
@@ -795,9 +795,8 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj)
reset_validation_state(&validation_state);
- validation_state.branch_targets =
- kcalloc(BITS_TO_LONGS(validation_state.max_ip),
- sizeof(unsigned long), GFP_KERNEL);
+ validation_state.branch_targets = bitmap_zalloc(validation_state.max_ip,
+ GFP_KERNEL);
if (!validation_state.branch_targets)
goto fail;
@@ -939,12 +938,12 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj)
(validated_shader->uniforms_size +
4 * validated_shader->num_texture_samples);
- kfree(validation_state.branch_targets);
+ bitmap_free(validation_state.branch_targets);
return validated_shader;
fail:
- kfree(validation_state.branch_targets);
+ bitmap_free(validation_state.branch_targets);
if (validated_shader) {
kfree(validated_shader->uniform_addr_offsets);
kfree(validated_shader->texture_samples);
--
2.34.1
Powered by blists - more mailing lists