diff mbox

[22/37] drm: Free adjusted mode on set_mode() failure path.

Message ID 1268261124-13653-23-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State Not Applicable
Headers show

Commit Message

Chris Wilson March 10, 2010, 10:45 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 6b2cd91..d36c4ca 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -650,9 +650,8 @@  bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 	adjusted_mode = drm_mode_duplicate(dev, mode);
 
 	crtc->enabled = drm_helper_crtc_in_use(crtc);
-
 	if (!crtc->enabled)
-		return true;
+		goto done;
 
 	saved_mode = crtc->mode;
 	saved_x = crtc->x;
@@ -732,10 +731,10 @@  bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 
 	}
 
-	/* XXX free adjustedmode */
-	drm_mode_destroy(dev, adjusted_mode);
 	/* FIXME: add subpixel order */
 done:
+	drm_mode_destroy(dev, adjusted_mode);
+
 	if (!ret) {
 		crtc->mode = saved_mode;
 		crtc->x = saved_x;