diff mbox

drm/radeon: fix order of doing things in radeon_crtc_cursor_set

Message ID 1304554503-10458-1-git-send-email-ihadzic@research.bell-labs.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilija Hadzic May 5, 2011, 12:15 a.m. UTC
if object pin or object lookup in radeon_cursor_set fail, the function
 could leave inconsistent mouse width and hight values in radeon_crtc
 fixed by moving cursor width and height assignments after all
 checks have passed


Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
---
 drivers/gpu/drm/radeon/radeon_cursor.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Alex Deucher May 5, 2011, 12:45 a.m. UTC | #1
On Wed, May 4, 2011 at 8:15 PM, Ilija Hadzic
<ihadzic@research.bell-labs.com> wrote:
>  if object pin or object lookup in radeon_cursor_set fail, the function
>  could leave inconsistent mouse width and hight values in radeon_crtc
>  fixed by moving cursor width and height assignments after all
>  checks have passed
>
>
> Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>

Reviewed-by: Alex Deucher <alexdeucher@gmail.com>

> ---
>  drivers/gpu/drm/radeon/radeon_cursor.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
> index bdf2fa1..3189a7e 100644
> --- a/drivers/gpu/drm/radeon/radeon_cursor.c
> +++ b/drivers/gpu/drm/radeon/radeon_cursor.c
> @@ -167,9 +167,6 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
>                return -EINVAL;
>        }
>
> -       radeon_crtc->cursor_width = width;
> -       radeon_crtc->cursor_height = height;
> -
>        obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
>        if (!obj) {
>                DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id);
> @@ -180,6 +177,9 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
>        if (ret)
>                goto fail;
>
> +       radeon_crtc->cursor_width = width;
> +       radeon_crtc->cursor_height = height;
> +
>        radeon_lock_cursor(crtc, true);
>        /* XXX only 27 bit offset for legacy cursor */
>        radeon_set_cursor(crtc, obj, gpu_addr);
> --
> 1.7.4.1
>
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index bdf2fa1..3189a7e 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -167,9 +167,6 @@  int radeon_crtc_cursor_set(struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
-	radeon_crtc->cursor_width = width;
-	radeon_crtc->cursor_height = height;
-
 	obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
 	if (!obj) {
 		DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id);
@@ -180,6 +177,9 @@  int radeon_crtc_cursor_set(struct drm_crtc *crtc,
 	if (ret)
 		goto fail;
 
+	radeon_crtc->cursor_width = width;
+	radeon_crtc->cursor_height = height;
+
 	radeon_lock_cursor(crtc, true);
 	/* XXX only 27 bit offset for legacy cursor */
 	radeon_set_cursor(crtc, obj, gpu_addr);