drm/vmwgfx: Fix up an error path during bo creation

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by Thomas Hellstrom and committed by Dave Airlie 2f5993cc a5193fe5

+8 -6
+8 -6
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
··· 862 &vmw_vram_sys_placement, true, 863 &vmw_user_dmabuf_destroy); 864 if (unlikely(ret != 0)) 865 - return ret; 866 867 tmp = ttm_bo_reference(&vmw_user_bo->dma.base); 868 ret = ttm_base_object_init(vmw_fpriv(file_priv)->tfile, ··· 870 false, 871 ttm_buffer_type, 872 &vmw_user_dmabuf_release, NULL); 873 - if (unlikely(ret != 0)) { 874 - ttm_bo_unref(&tmp); 875 - } else { 876 rep->handle = vmw_user_bo->base.hash.key; 877 rep->map_handle = vmw_user_bo->dma.base.addr_space_offset; 878 rep->cur_gmr_id = vmw_user_bo->base.hash.key; 879 rep->cur_gmr_offset = 0; 880 } 881 - ttm_bo_unref(&tmp); 882 883 ttm_read_unlock(&vmaster->lock); 884 885 - return 0; 886 } 887 888 int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data,
··· 862 &vmw_vram_sys_placement, true, 863 &vmw_user_dmabuf_destroy); 864 if (unlikely(ret != 0)) 865 + goto out_no_dmabuf; 866 867 tmp = ttm_bo_reference(&vmw_user_bo->dma.base); 868 ret = ttm_base_object_init(vmw_fpriv(file_priv)->tfile, ··· 870 false, 871 ttm_buffer_type, 872 &vmw_user_dmabuf_release, NULL); 873 + if (unlikely(ret != 0)) 874 + goto out_no_base_object; 875 + else { 876 rep->handle = vmw_user_bo->base.hash.key; 877 rep->map_handle = vmw_user_bo->dma.base.addr_space_offset; 878 rep->cur_gmr_id = vmw_user_bo->base.hash.key; 879 rep->cur_gmr_offset = 0; 880 } 881 882 + out_no_base_object: 883 + ttm_bo_unref(&tmp); 884 + out_no_dmabuf: 885 ttm_read_unlock(&vmaster->lock); 886 887 + return ret; 888 } 889 890 int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data,