drm/nouveau: fix pin refcnt leak in failure path

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2014-11-06 14:34:31 +10:00
parent b22870ba6a
commit 6aac6ced4e
1 changed files with 12 additions and 12 deletions

View File

@ -333,7 +333,9 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
nouveau_bo_placement_set(nvbo, memtype, 0);
ret = nouveau_bo_validate(nvbo, false, false);
if (ret == 0) {
if (ret)
goto out;
switch (bo->mem.mem_type) {
case TTM_PL_VRAM:
drm->gem.vram_available -= bo->mem.size;
@ -344,11 +346,9 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
default:
break;
}
}
ref_inc:
nvbo->pin_refcnt++;
out:
ttm_bo_unreserve(bo);
return ret;