From: Thomas Hellstrom Date: Fri, 9 Nov 2012 12:26:15 +0000 (+0000) Subject: drm/vmwgfx: Make vmw_dmabuf_unreference handle NULL objects X-Git-Tag: next-20121205~75^2~127 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bf6f036848ab2151c2498f11cb7d31a52a95dd5c;p=karo-tx-linux.git drm/vmwgfx: Make vmw_dmabuf_unreference handle NULL objects Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul Reviewed-by: Dmitry Torokhov Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 88a179e26de9..7c6f6e3a3c81 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -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)