diff options
author | Dave Airlie <airlied@redhat.com> | 2014-01-15 23:28:22 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-01-15 23:43:04 -0500 |
commit | 53dac830537b51df555ba5e7ebb236705b7eaa7c (patch) | |
tree | 40c529676e0f0fd6784f229eb7df00af8bb706a7 /drivers/gpu/drm | |
parent | c5416d661daa9ccef4f42259ad0d48e28b5f950f (diff) |
drm/mgag200: fix oops in cursor code.
In some cases we enter the cursor code with file_priv = NULL causing an oops,
we also can try to unpin something that isn't pinned, and this is a good fix for it.
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_cursor.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c index 801731aeab61..9f9780b7ddf0 100644 --- a/drivers/gpu/drm/mgag200/mgag200_cursor.c +++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c | |||
@@ -22,8 +22,10 @@ static void mga_hide_cursor(struct mga_device *mdev) | |||
22 | { | 22 | { |
23 | WREG8(MGA_CURPOSXL, 0); | 23 | WREG8(MGA_CURPOSXL, 0); |
24 | WREG8(MGA_CURPOSXH, 0); | 24 | WREG8(MGA_CURPOSXH, 0); |
25 | mgag200_bo_unpin(mdev->cursor.pixels_1); | 25 | if (mdev->cursor.pixels_1->pin_count) |
26 | mgag200_bo_unpin(mdev->cursor.pixels_2); | 26 | mgag200_bo_unpin(mdev->cursor.pixels_1); |
27 | if (mdev->cursor.pixels_2->pin_count) | ||
28 | mgag200_bo_unpin(mdev->cursor.pixels_2); | ||
27 | } | 29 | } |
28 | 30 | ||
29 | int mga_crtc_cursor_set(struct drm_crtc *crtc, | 31 | int mga_crtc_cursor_set(struct drm_crtc *crtc, |
@@ -32,7 +34,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc, | |||
32 | uint32_t width, | 34 | uint32_t width, |
33 | uint32_t height) | 35 | uint32_t height) |
34 | { | 36 | { |
35 | struct drm_device *dev = (struct drm_device *)file_priv->minor->dev; | 37 | struct drm_device *dev = crtc->dev; |
36 | struct mga_device *mdev = (struct mga_device *)dev->dev_private; | 38 | struct mga_device *mdev = (struct mga_device *)dev->dev_private; |
37 | struct mgag200_bo *pixels_1 = mdev->cursor.pixels_1; | 39 | struct mgag200_bo *pixels_1 = mdev->cursor.pixels_1; |
38 | struct mgag200_bo *pixels_2 = mdev->cursor.pixels_2; | 40 | struct mgag200_bo *pixels_2 = mdev->cursor.pixels_2; |