Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53dac830 authored by Dave Airlie's avatar Dave Airlie
Browse files

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: default avatarDave Airlie <airlied@redhat.com>
parent c5416d66
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -22,7 +22,9 @@ static void mga_hide_cursor(struct mga_device *mdev)
{
	WREG8(MGA_CURPOSXL, 0);
	WREG8(MGA_CURPOSXH, 0);
	if (mdev->cursor.pixels_1->pin_count)
		mgag200_bo_unpin(mdev->cursor.pixels_1);
	if (mdev->cursor.pixels_2->pin_count)
		mgag200_bo_unpin(mdev->cursor.pixels_2);
}

@@ -32,7 +34,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
			uint32_t width,
			uint32_t height)
{
	struct drm_device *dev = (struct drm_device *)file_priv->minor->dev;
	struct drm_device *dev = crtc->dev;
	struct mga_device *mdev = (struct mga_device *)dev->dev_private;
	struct mgag200_bo *pixels_1 = mdev->cursor.pixels_1;
	struct mgag200_bo *pixels_2 = mdev->cursor.pixels_2;