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