aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2018-11-29 10:04:15 -0500
committerSean Paul <seanpaul@chromium.org>2018-11-29 10:48:30 -0500
commitc232e9f41b136c141df9938024e521191a7b910d (patch)
treeceb3b819137bfa2ede83b93b5e66bdb2ef7ea831
parentaa394b0dd68cb00c483e151dcd84713d4d517ed1 (diff)
drm: Move drm_mode_setcrtc() local re-init to failure path
Instead of always re-initializing the variables we need to clean up on out, move the re-initialization into the branch that goes back to retry label. This is a lateral move right now, but will allow us to pull out the modeset locking into common code. I kept this change separate to make things easier to review. Changes in v2: - None Reviewed-by: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-2-sean@poorly.run
-rw-r--r--drivers/gpu/drm/drm_crtc.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 268a182ae189..af4b94ce8e94 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -570,9 +570,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
570 struct drm_mode_crtc *crtc_req = data; 570 struct drm_mode_crtc *crtc_req = data;
571 struct drm_crtc *crtc; 571 struct drm_crtc *crtc;
572 struct drm_plane *plane; 572 struct drm_plane *plane;
573 struct drm_connector **connector_set, *connector; 573 struct drm_connector **connector_set = NULL, *connector;
574 struct drm_framebuffer *fb; 574 struct drm_framebuffer *fb = NULL;
575 struct drm_display_mode *mode; 575 struct drm_display_mode *mode = NULL;
576 struct drm_mode_set set; 576 struct drm_mode_set set;
577 uint32_t __user *set_connectors_ptr; 577 uint32_t __user *set_connectors_ptr;
578 struct drm_modeset_acquire_ctx ctx; 578 struct drm_modeset_acquire_ctx ctx;
@@ -601,10 +601,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
601 mutex_lock(&crtc->dev->mode_config.mutex); 601 mutex_lock(&crtc->dev->mode_config.mutex);
602 drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE); 602 drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
603retry: 603retry:
604 connector_set = NULL;
605 fb = NULL;
606 mode = NULL;
607
608 ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx); 604 ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
609 if (ret) 605 if (ret)
610 goto out; 606 goto out;
@@ -766,6 +762,12 @@ out:
766 } 762 }
767 kfree(connector_set); 763 kfree(connector_set);
768 drm_mode_destroy(dev, mode); 764 drm_mode_destroy(dev, mode);
765
766 /* In case we need to retry... */
767 connector_set = NULL;
768 fb = NULL;
769 mode = NULL;
770
769 if (ret == -EDEADLK) { 771 if (ret == -EDEADLK) {
770 ret = drm_modeset_backoff(&ctx); 772 ret = drm_modeset_backoff(&ctx);
771 if (!ret) 773 if (!ret)