summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2009-01-22 21:19:56 +1000
committerDave Airlie <airlied@linux.ie>2009-01-22 21:19:56 +1000
commita5b54eb3c99aedf92197c834a6645127a231b382 (patch)
treed43c6c89113e63d059069df46939e5b5108393d5
parent11995807f1d83e29e4517c6ae5449cd702f33835 (diff)
radeon: cleanup bo unref codepath in pending code
assert for bad case hopefully
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo_legacy.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
index c4026be971..353f00100a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
@@ -190,10 +190,14 @@ static int legacy_is_pending(struct radeon_bo *bo)
if (bo_legacy->pnext) {
bo_legacy->pnext->pprev = bo_legacy->pprev;
}
+ assert(bo_legacy->is_pending <= bo->cref);
while (bo_legacy->is_pending--) {
- radeon_bo_unref(bo);
+ bo = radeon_bo_unref(bo);
+ if (!bo)
+ break;
}
- bo_legacy->is_pending = 0;
+ if (bo)
+ bo_legacy->is_pending = 0;
boml->cpendings--;
return 0;
}
@@ -580,7 +584,7 @@ void radeon_bo_legacy_pending(struct radeon_bo *bo, uint32_t pending)
struct bo_legacy *bo_legacy = (struct bo_legacy*)bo;
bo_legacy->pending = pending;
- bo_legacy->is_pending += 1;
+ bo_legacy->is_pending++;
/* add to pending list */
radeon_bo_ref(bo);
if (bo_legacy->is_pending > 1) {