public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/2] drm/i915: Don't leak connector state on SDVO init failure
Date: Tue,  8 Dec 2015 14:48:51 -0800	[thread overview]
Message-ID: <1449614932-20258-1-git-send-email-matthew.d.roper@intel.com> (raw)

In all of our various SDVO setup functions, we allocate an SDVO
connector (along with an associated connector->state) object, then
perform initialization.  If that initialization fails, we need to make
sure to free the state object as well as the connector.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 06679f1..ff28867 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2479,6 +2479,8 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
 	}
 
 	if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
+		drm_atomic_helper_connector_destroy_state(connector,
+							  connector->state);
 		kfree(intel_sdvo_connector);
 		return false;
 	}
@@ -2514,6 +2516,8 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
 	intel_sdvo->is_tv = true;
 
 	if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
+		drm_atomic_helper_connector_destroy_state(connector,
+							  connector->state);
 		kfree(intel_sdvo_connector);
 		return false;
 	}
@@ -2561,6 +2565,8 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
 	}
 
 	if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
+		drm_atomic_helper_connector_destroy_state(connector,
+							  connector->state);
 		kfree(intel_sdvo_connector);
 		return false;
 	}
@@ -2596,6 +2602,8 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
 	}
 
 	if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
+		drm_atomic_helper_connector_destroy_state(connector,
+							  connector->state);
 		kfree(intel_sdvo_connector);
 		return false;
 	}
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2015-12-08 22:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 22:48 Matt Roper [this message]
2015-12-08 22:48 ` [PATCH 2/2] drm/i915: Drop unnecessary NULL test Matt Roper
2015-12-10 14:15   ` Daniel Vetter
2015-12-10 14:14 ` [PATCH 1/2] drm/i915: Don't leak connector state on SDVO init failure Daniel Vetter
2015-12-11  1:57   ` Matt Roper
2015-12-11 17:28     ` Daniel Vetter

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=1449614932-20258-1-git-send-email-matthew.d.roper@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-gfx@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