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 <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32233>
This commit is contained in:
Lucas Stach 2024-11-12 17:16:12 +01:00 committed by Marge Bot
parent b471f75215
commit 6dd1640ff6
2 changed files with 3 additions and 4 deletions

View file

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

View file

@ -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;
}