Skip to content

Commit

Permalink
drm/vmwgfx: Make vmw_dmabuf_unreference handle NULL objects
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Thomas Hellstrom authored and Dave Airlie committed Nov 20, 2012
1 parent 506ff75 commit bf6f036
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,13 @@ static inline struct vmw_surface *vmw_surface_reference(struct vmw_surface *srf)
static inline void vmw_dmabuf_unreference(struct vmw_dma_buffer **buf)
{
struct vmw_dma_buffer *tmp_buf = *buf;
struct ttm_buffer_object *bo = &tmp_buf->base;

*buf = NULL;
if (tmp_buf != NULL) {
struct ttm_buffer_object *bo = &tmp_buf->base;

ttm_bo_unref(&bo);
ttm_bo_unref(&bo);
}
}

static inline struct vmw_dma_buffer *vmw_dmabuf_reference(struct vmw_dma_buffer *buf)
Expand Down

0 comments on commit bf6f036

Please sign in to comment.