From 6dd1640ff65edd1ff87ea69fce95a6ce5c0036e2 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Tue, 12 Nov 2024 17:16:12 +0100 Subject: [PATCH] etnaviv: drm: properly handle BO list member The BO list member isn't the head/entrypoint for a list, but is only to be used to link the BO in various lists, so it should not be initialized as a list head. Now that the member is properly NULL initialized, we can use the proper list_is_linked() function to check if the BO is on any cache bucket or the zombie list. Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Part-of: --- src/etnaviv/drm/etnaviv_bo.c | 5 ++--- src/etnaviv/drm/etnaviv_bo_cache.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/etnaviv/drm/etnaviv_bo.c b/src/etnaviv/drm/etnaviv_bo.c index 511f32a9853..b1f3f9cb83e 100644 --- a/src/etnaviv/drm/etnaviv_bo.c +++ b/src/etnaviv/drm/etnaviv_bo.c @@ -139,10 +139,10 @@ static struct etna_bo *lookup_bo(void *tbl, uint32_t handle) bo = etna_bo_ref(entry->data); /* don't break the bucket/zombie list if this bo was found in one */ - if (!list_is_empty(&bo->list)) { + if (list_is_linked(&bo->list)) { VG_BO_OBTAIN(bo); etna_device_ref(bo->dev); - list_delinit(&bo->list); + list_del(&bo->list); } } @@ -172,7 +172,6 @@ static struct etna_bo *bo_from_handle(struct etna_device *dev, bo->handle = handle; bo->flags = flags; p_atomic_set(&bo->refcnt, 1); - list_inithead(&bo->list); /* add ourselves to the handle table: */ _mesa_hash_table_insert(dev->handle_table, &bo->handle, bo); diff --git a/src/etnaviv/drm/etnaviv_bo_cache.c b/src/etnaviv/drm/etnaviv_bo_cache.c index 70a7bb8105a..1d0af059db9 100644 --- a/src/etnaviv/drm/etnaviv_bo_cache.c +++ b/src/etnaviv/drm/etnaviv_bo_cache.c @@ -124,7 +124,7 @@ static struct etna_bo *find_in_bucket(struct etna_bo_bucket *bucket, uint32_t fl /* check if the first BO with matching flags is idle */ if (etna_bo_is_idle(bo)) { - list_delinit(&bo->list); + list_del(&bo->list); goto out_unlock; }