Module: Mesa Branch: main Commit: 790d4422b2b4ec5f5e8025e4cf06ccfca3c767de URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=790d4422b2b4ec5f5e8025e4cf06ccfca3c767de
Author: Boris Brezillon <[email protected]> Date: Thu Oct 12 18:25:37 2023 +0200 pan/bo: Make sure we catch refcnt underflows Recently had to debug an unbalanced ref/unref situation in some code I added, and having an assert(refcnt > 0) in panfrost_bo_unreference() would have made this simpler, so let's add one. Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26221> --- src/panfrost/lib/pan_bo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panfrost/lib/pan_bo.c b/src/panfrost/lib/pan_bo.c index b884cff4488..b84eeeef1b5 100644 --- a/src/panfrost/lib/pan_bo.c +++ b/src/panfrost/lib/pan_bo.c @@ -431,6 +431,7 @@ panfrost_bo_unreference(struct panfrost_bo *bo) return; /* Don't return to cache if there are still references */ + assert(p_atomic_read(&bo->refcnt) > 0); if (p_atomic_dec_return(&bo->refcnt)) return;
