[PATCH] drm/komeda: use bitmap API to convert U32 to bitmap

From: Yury Norov
Date: Mon Dec 28 2020 - 18:18:25 EST


The commit be3e477effba636ad25 ("drm/komeda: Fix bit
check to import to value of proper type") fixes possible
out-of-bound issue related to find_first_bit() usage, but
does not address the endianness problem.

We can use bitmap_from_arr32() here.

Since I have no hardware, the patch is compile-testes only.
Carsten, could you please test it and consider including into
your tree?

Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
---
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
index 719a79728e24..27968215e41d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
@@ -136,11 +136,12 @@ struct komeda_component *
komeda_pipeline_get_first_component(struct komeda_pipeline *pipe,
u32 comp_mask)
{
+ DECLARE_BITMAP(comp_mask_local, 32);
struct komeda_component *c = NULL;
- unsigned long comp_mask_local = (unsigned long)comp_mask;
int id;

- id = find_first_bit(&comp_mask_local, 32);
+ bitmap_from_arr32(comp_mask_local, &comp_mask, 32);
+ id = find_first_bit(comp_mask_local, 32);
if (id < 32)
c = komeda_pipeline_get_component(pipe, id);

--
2.25.1