aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500/gma_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/gma500/gma_display.c')
-rw-r--r--drivers/gpu/drm/gma500/gma_display.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
index 24e8af3d22bf..386de2c9dc86 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -349,6 +349,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
349 /* If we didn't get a handle then turn the cursor off */ 349 /* If we didn't get a handle then turn the cursor off */
350 if (!handle) { 350 if (!handle) {
351 temp = CURSOR_MODE_DISABLE; 351 temp = CURSOR_MODE_DISABLE;
352 mutex_lock(&dev->struct_mutex);
352 353
353 if (gma_power_begin(dev, false)) { 354 if (gma_power_begin(dev, false)) {
354 REG_WRITE(control, temp); 355 REG_WRITE(control, temp);
@@ -365,6 +366,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
365 gma_crtc->cursor_obj = NULL; 366 gma_crtc->cursor_obj = NULL;
366 } 367 }
367 368
369 mutex_unlock(&dev->struct_mutex);
368 return 0; 370 return 0;
369 } 371 }
370 372
@@ -374,9 +376,12 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
374 return -EINVAL; 376 return -EINVAL;
375 } 377 }
376 378
379 mutex_lock(&dev->struct_mutex);
377 obj = drm_gem_object_lookup(dev, file_priv, handle); 380 obj = drm_gem_object_lookup(dev, file_priv, handle);
378 if (!obj) 381 if (!obj) {
379 return -ENOENT; 382 ret = -ENOENT;
383 goto unlock;
384 }
380 385
381 if (obj->size < width * height * 4) { 386 if (obj->size < width * height * 4) {
382 dev_dbg(dev->dev, "Buffer is too small\n"); 387 dev_dbg(dev->dev, "Buffer is too small\n");
@@ -440,10 +445,13 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
440 } 445 }
441 446
442 gma_crtc->cursor_obj = obj; 447 gma_crtc->cursor_obj = obj;
448unlock:
449 mutex_unlock(&dev->struct_mutex);
443 return ret; 450 return ret;
444 451
445unref_cursor: 452unref_cursor:
446 drm_gem_object_unreference(obj); 453 drm_gem_object_unreference(obj);
454 mutex_unlock(&dev->struct_mutex);
447 return ret; 455 return ret;
448} 456}
449 457