drm/vmwgfx: Don't access file_priv in cursor_set when handle==0
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 3 Jun 2013 13:10:41 +0000 (16:10 +0300)
committerDave Airlie <airlied@redhat.com>
Mon, 10 Jun 2013 22:47:32 +0000 (08:47 +1000)
We want to disable the cursor by calling ->cursor_set() with handle=0
from places where we don't have a file_priv, so don't try to access it
unless necessary.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

index 3e3c7ab33ca252008713e1050b297592d784e354..d4607b2530d68d150c8bf545b6b6c1e8a6518dbd 100644 (file)
@@ -174,7 +174,6 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
                           uint32_t handle, uint32_t width, uint32_t height)
 {
        struct vmw_private *dev_priv = vmw_priv(crtc->dev);
-       struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
        struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
        struct vmw_surface *surface = NULL;
        struct vmw_dma_buffer *dmabuf = NULL;
@@ -197,6 +196,8 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
        }
 
        if (handle) {
+               struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+
                ret = vmw_user_lookup_handle(dev_priv, tfile,
                                             handle, &surface, &dmabuf);
                if (ret) {