diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-11-06 14:34:31 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-12-02 15:44:00 +1000 |
commit | 6aac6ced4e285a7831e759bd7bbc18c8631b0682 (patch) | |
tree | ded2df0348feb8623036620b8c9a003a83d5ffcc /drivers/gpu/drm/nouveau | |
parent | b22870ba6a5c7bd4380f224eeabf335b1f8792b3 (diff) |
drm/nouveau: fix pin refcnt leak in failure path
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index d2a4768e3efd..d409b26607f3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -333,22 +333,22 @@ 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) { - switch (bo->mem.mem_type) { - case TTM_PL_VRAM: - drm->gem.vram_available -= bo->mem.size; - break; - case TTM_PL_TT: - drm->gem.gart_available -= bo->mem.size; - break; - default: - break; - } + if (ret) + goto out; + + switch (bo->mem.mem_type) { + case TTM_PL_VRAM: + drm->gem.vram_available -= bo->mem.size; + break; + case TTM_PL_TT: + drm->gem.gart_available -= bo->mem.size; + break; + default: + break; } ref_inc: nvbo->pin_refcnt++; - out: ttm_bo_unreserve(bo); return ret; |