summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-04 13:50:27 +0100
committerEric Anholt <eric@anholt.net>2010-08-09 11:24:29 -0700
commitfcc8d6721cef2158398139d66cc99b5e843126a0 (patch)
tree9518840ff67d41c362a92ab88851a0e9eb8dcf67
parent400397506f96466a7f57911b33b4b9c075880994 (diff)
downloadblackbird-op-linux-fcc8d6721cef2158398139d66cc99b5e843126a0.tar.gz
blackbird-op-linux-fcc8d6721cef2158398139d66cc99b5e843126a0.zip
drm/i915/sdvo: Check for allocation failure when constructing properties
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c40
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 ce8e4432d1c5..72fec054c264 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1687,8 +1687,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;
@@ -2104,6 +2104,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;
}
@@ -2178,6 +2179,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;
}
@@ -2269,6 +2271,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(
@@ -2321,14 +2325,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,
@@ -2355,14 +2366,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,
@@ -2388,6 +2406,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,
@@ -2413,6 +2434,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,
@@ -2438,6 +2462,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];
@@ -2462,6 +2489,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,
@@ -2485,6 +2515,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];
@@ -2510,6 +2543,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];
OpenPOWER on IntegriCloud