All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 5/7] drm/i915/sdvo: Check for allocation failure when constructing properties
Date: Mon, 19 Jul 2010 14:25:46 +0100	[thread overview]
Message-ID: <1279545948-24378-6-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1279545948-24378-1-git-send-email-chris@chris-wilson.co.uk>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_sdvo.c |   40 +++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index a30d751..d5f1b27 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1685,8 +1685,8 @@ static int intel_sdvo_get_modes(struct drm_connector *connector)
 	return !list_empty(&connector->probed_modes);
 }
 
-static
-void intel_sdvo_destroy_enhance_property(struct drm_connector *connector)
+static void
+intel_sdvo_destroy_enhance_property(struct drm_connector *connector)
 {
 	struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
 	struct drm_device *dev = connector->dev;
@@ -2102,6 +2102,7 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
         return true;
 
 err:
+	intel_sdvo_destroy_enhance_property(connector);
 	kfree(intel_sdvo_connector);
 	return false;
 }
@@ -2176,6 +2177,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
 	return true;
 
 err:
+	intel_sdvo_destroy_enhance_property(connector);
 	kfree(intel_sdvo_connector);
 	return false;
 }
@@ -2267,6 +2269,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
 	intel_sdvo_connector->tv_format_property =
 			drm_property_create(dev, DRM_MODE_PROP_ENUM,
 					    "mode", intel_sdvo_connector->format_supported_num);
+	if (!intel_sdvo_connector->tv_format_property)
+		return false;
 
 	for (i = 0; i < intel_sdvo_connector->format_supported_num; i++)
 		drm_property_add_enum(
@@ -2319,14 +2323,21 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->left_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"left_margin", 2);
+			if (!intel_sdvo_connector->left_property)
+				return false;
+
 			intel_sdvo_connector->left_property->values[0] = 0;
 			intel_sdvo_connector->left_property->values[1] = data_value[0];
 			drm_connector_attach_property(connector,
 						intel_sdvo_connector->left_property,
 						intel_sdvo_connector->left_margin);
+
 			intel_sdvo_connector->right_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"right_margin", 2);
+			if (!intel_sdvo_connector->right_property)
+				return false;
+
 			intel_sdvo_connector->right_property->values[0] = 0;
 			intel_sdvo_connector->right_property->values[1] = data_value[0];
 			drm_connector_attach_property(connector,
@@ -2353,14 +2364,21 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->top_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"top_margin", 2);
+			if (!intel_sdvo_connector->top_property)
+				return false;
+
 			intel_sdvo_connector->top_property->values[0] = 0;
 			intel_sdvo_connector->top_property->values[1] = data_value[0];
 			drm_connector_attach_property(connector,
 						intel_sdvo_connector->top_property,
 						intel_sdvo_connector->top_margin);
+
 			intel_sdvo_connector->bottom_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"bottom_margin", 2);
+			if (!intel_sdvo_connector->bottom_property)
+				return false;
+
 			intel_sdvo_connector->bottom_property->values[0] = 0;
 			intel_sdvo_connector->bottom_property->values[1] = data_value[0];
 			drm_connector_attach_property(connector,
@@ -2386,6 +2404,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->hpos_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"hpos", 2);
+			if (!intel_sdvo_connector->hpos_property)
+				return false;
+
 			intel_sdvo_connector->hpos_property->values[0] = 0;
 			intel_sdvo_connector->hpos_property->values[1] = data_value[0];
 			drm_connector_attach_property(connector,
@@ -2411,6 +2432,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->vpos_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"vpos", 2);
+			if (!intel_sdvo_connector->vpos_property)
+				return false;
+
 			intel_sdvo_connector->vpos_property->values[0] = 0;
 			intel_sdvo_connector->vpos_property->values[1] = data_value[0];
 			drm_connector_attach_property(connector,
@@ -2436,6 +2460,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->saturation_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"saturation", 2);
+			if (!intel_sdvo_connector->saturation_property)
+				return false;
+
 			intel_sdvo_connector->saturation_property->values[0] = 0;
 			intel_sdvo_connector->saturation_property->values[1] =
 							data_value[0];
@@ -2460,6 +2487,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->contrast_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"contrast", 2);
+			if (!intel_sdvo_connector->contrast_property)
+				return false;
+
 			intel_sdvo_connector->contrast_property->values[0] = 0;
 			intel_sdvo_connector->contrast_property->values[1] = data_value[0];
 			drm_connector_attach_property(connector,
@@ -2483,6 +2513,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->hue_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"hue", 2);
+			if (!intel_sdvo_connector->hue_property)
+				return false;
+
 			intel_sdvo_connector->hue_property->values[0] = 0;
 			intel_sdvo_connector->hue_property->values[1] =
 							data_value[0];
@@ -2508,6 +2541,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo,
 			intel_sdvo_connector->brightness_property =
 				drm_property_create(dev, DRM_MODE_PROP_RANGE,
 						"brightness", 2);
+			if (!intel_sdvo_connector->brightness_property)
+				return false;
+
 			intel_sdvo_connector->brightness_property->values[0] = 0;
 			intel_sdvo_connector->brightness_property->values[1] =
 							data_value[0];
-- 
1.7.1

  parent reply	other threads:[~2010-07-19 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19 13:25 Revamp intel_sdvo and add missing properties Chris Wilson
2010-07-19 13:25 ` [PATCH 1/7] drm/i915: Subclass intel_encoder Chris Wilson
2010-08-02  2:43   ` Eric Anholt
2010-07-19 13:25 ` [PATCH 2/7] drm/i915: Subclass intel_connector Chris Wilson
2010-07-19 13:25 ` [PATCH 3/7] drm/i915/sdvo: Propagate errors from reading/writing control bus Chris Wilson
2010-07-19 13:25 ` [PATCH 4/7] drm/i915/sdvo: Use an integer mapping for supported tv format modes Chris Wilson
2010-07-19 13:25 ` Chris Wilson [this message]
2010-07-19 13:25 ` [PATCH 6/7] drm/i915/sdvo: Add missing TV filters Chris Wilson
2010-07-19 13:25 ` [PATCH 7/7] drm/i915/sdvo: Add dot crawl property Chris Wilson
2010-08-04 12:50 SVDO properties patchset Chris Wilson
2010-08-04 12:50 ` [PATCH 5/7] drm/i915/sdvo: Check for allocation failure when constructing properties Chris Wilson

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=1279545948-24378-6-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.