diff mbox series

drm/vc4: Use the bitmap API to allocate bitmaps

Message ID fdc12cbbb573482ce5a4f344b3a31bc9b6ef2ec1.1657309035.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show
Series drm/vc4: Use the bitmap API to allocate bitmaps | expand

Commit Message

Christophe JAILLET July 8, 2022, 7:37 p.m. UTC
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@wanadoo.fr>
---
 drivers/gpu/drm/vc4/vc4_validate_shaders.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

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);