dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: airlied@gmail.com
Cc: Thomas Hellstrom <thellstrom@vmware.com>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH 2/5] vmwgfx: Free prefered mode on error path
Date: Thu,  3 Nov 2011 21:03:05 +0100	[thread overview]
Message-ID: <1320350588-9080-3-git-send-email-thellstrom@vmware.com> (raw)
In-Reply-To: <1320350588-9080-1-git-send-email-thellstrom@vmware.com>

From: Jakob Bornecrantz <jakob@vmware.com>

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 41a905d..667437b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1710,17 +1710,22 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
 		mode->hdisplay = du->pref_width;
 		mode->vdisplay = du->pref_height;
 		vmw_guess_mode_timing(mode);
+
 		if (vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * 2,
 					       mode->vdisplay)) {
 			drm_mode_probed_add(connector, mode);
+		} else {
+			drm_mode_destroy(dev, mode);
+			mode = NULL;
+		}
 
-			if (du->pref_mode) {
-				list_del_init(&du->pref_mode->head);
-				drm_mode_destroy(dev, du->pref_mode);
-			}
-
-			du->pref_mode = mode;
+		if (du->pref_mode) {
+			list_del_init(&du->pref_mode->head);
+			drm_mode_destroy(dev, du->pref_mode);
 		}
+
+		/* mode might be null here, this is intended */
+		du->pref_mode = mode;
 	}
 
 	for (i = 0; vmw_kms_connector_builtin[i].type != 0; i++) {
-- 
1.7.4.4

  parent reply	other threads:[~2011-11-03 20:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 20:03 [PATCH 0/5 -fixes] More vmwgfx fixes for 3.2 Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 1/5] vmwgfx: Use pointer return error codes Thomas Hellstrom
2011-11-03 20:03 ` Thomas Hellstrom [this message]
2011-11-03 20:03 ` [PATCH 3/5] vmwgfx: Unreference surface on cursor error path Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 4/5] vmwgfx: Move the prefered mode first in the list Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 5/5] vmwgfx: Snoop DMA transfers with non-covering sizes Thomas Hellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320350588-9080-3-git-send-email-thellstrom@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox