Commit 6aac6ced authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: fix pin refcnt leak in failure path

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent b22870ba
...@@ -333,22 +333,22 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype) ...@@ -333,22 +333,22 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
nouveau_bo_placement_set(nvbo, memtype, 0); nouveau_bo_placement_set(nvbo, memtype, 0);
ret = nouveau_bo_validate(nvbo, false, false); ret = nouveau_bo_validate(nvbo, false, false);
if (ret == 0) { if (ret)
switch (bo->mem.mem_type) { goto out;
case TTM_PL_VRAM:
drm->gem.vram_available -= bo->mem.size; switch (bo->mem.mem_type) {
break; case TTM_PL_VRAM:
case TTM_PL_TT: drm->gem.vram_available -= bo->mem.size;
drm->gem.gart_available -= bo->mem.size; break;
break; case TTM_PL_TT:
default: drm->gem.gart_available -= bo->mem.size;
break; break;
} default:
break;
} }
ref_inc: ref_inc:
nvbo->pin_refcnt++; nvbo->pin_refcnt++;
out: out:
ttm_bo_unreserve(bo); ttm_bo_unreserve(bo);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment