diff mbox

[2/3] drm/vmwgfx: Don't access file_priv in cursor_set when handle==0

Message ID 1370265042-13969-3-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjala June 3, 2013, 1:10 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jakob Bornecrantz June 3, 2013, 2:52 p.m. UTC | #1
Thanks, looks good and is
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

Cheers, Jakob.


On Mon, Jun 3, 2013 at 3:10 PM, <ville.syrjala@linux.intel.com> wrote:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> 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>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 3e3c7ab..d4607b2 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -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) {
> --
> 1.8.1.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 3e3c7ab..d4607b2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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) {