diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-08-04 08:50:27 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-08-09 14:24:29 -0400 |
commit | fcc8d6721cef2158398139d66cc99b5e843126a0 (patch) | |
tree | 9518840ff67d41c362a92ab88851a0e9eb8dcf67 | |
parent | 400397506f96466a7f57911b33b4b9c075880994 (diff) |
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.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 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) | |||
1687 | return !list_empty(&connector->probed_modes); | 1687 | return !list_empty(&connector->probed_modes); |
1688 | } | 1688 | } |
1689 | 1689 | ||
1690 | static | 1690 | static void |
1691 | void intel_sdvo_destroy_enhance_property(struct drm_connector *connector) | 1691 | intel_sdvo_destroy_enhance_property(struct drm_connector *connector) |
1692 | { | 1692 | { |
1693 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); | 1693 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); |
1694 | struct drm_device *dev = connector->dev; | 1694 | struct drm_device *dev = connector->dev; |
@@ -2104,6 +2104,7 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type) | |||
2104 | return true; | 2104 | return true; |
2105 | 2105 | ||
2106 | err: | 2106 | err: |
2107 | intel_sdvo_destroy_enhance_property(connector); | ||
2107 | kfree(intel_sdvo_connector); | 2108 | kfree(intel_sdvo_connector); |
2108 | return false; | 2109 | return false; |
2109 | } | 2110 | } |
@@ -2178,6 +2179,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) | |||
2178 | return true; | 2179 | return true; |
2179 | 2180 | ||
2180 | err: | 2181 | err: |
2182 | intel_sdvo_destroy_enhance_property(connector); | ||
2181 | kfree(intel_sdvo_connector); | 2183 | kfree(intel_sdvo_connector); |
2182 | return false; | 2184 | return false; |
2183 | } | 2185 | } |
@@ -2269,6 +2271,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo, | |||
2269 | intel_sdvo_connector->tv_format_property = | 2271 | intel_sdvo_connector->tv_format_property = |
2270 | drm_property_create(dev, DRM_MODE_PROP_ENUM, | 2272 | drm_property_create(dev, DRM_MODE_PROP_ENUM, |
2271 | "mode", intel_sdvo_connector->format_supported_num); | 2273 | "mode", intel_sdvo_connector->format_supported_num); |
2274 | if (!intel_sdvo_connector->tv_format_property) | ||
2275 | return false; | ||
2272 | 2276 | ||
2273 | for (i = 0; i < intel_sdvo_connector->format_supported_num; i++) | 2277 | for (i = 0; i < intel_sdvo_connector->format_supported_num; i++) |
2274 | drm_property_add_enum( | 2278 | drm_property_add_enum( |
@@ -2321,14 +2325,21 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2321 | intel_sdvo_connector->left_property = | 2325 | intel_sdvo_connector->left_property = |
2322 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2326 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2323 | "left_margin", 2); | 2327 | "left_margin", 2); |
2328 | if (!intel_sdvo_connector->left_property) | ||
2329 | return false; | ||
2330 | |||
2324 | intel_sdvo_connector->left_property->values[0] = 0; | 2331 | intel_sdvo_connector->left_property->values[0] = 0; |
2325 | intel_sdvo_connector->left_property->values[1] = data_value[0]; | 2332 | intel_sdvo_connector->left_property->values[1] = data_value[0]; |
2326 | drm_connector_attach_property(connector, | 2333 | drm_connector_attach_property(connector, |
2327 | intel_sdvo_connector->left_property, | 2334 | intel_sdvo_connector->left_property, |
2328 | intel_sdvo_connector->left_margin); | 2335 | intel_sdvo_connector->left_margin); |
2336 | |||
2329 | intel_sdvo_connector->right_property = | 2337 | intel_sdvo_connector->right_property = |
2330 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2338 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2331 | "right_margin", 2); | 2339 | "right_margin", 2); |
2340 | if (!intel_sdvo_connector->right_property) | ||
2341 | return false; | ||
2342 | |||
2332 | intel_sdvo_connector->right_property->values[0] = 0; | 2343 | intel_sdvo_connector->right_property->values[0] = 0; |
2333 | intel_sdvo_connector->right_property->values[1] = data_value[0]; | 2344 | intel_sdvo_connector->right_property->values[1] = data_value[0]; |
2334 | drm_connector_attach_property(connector, | 2345 | drm_connector_attach_property(connector, |
@@ -2355,14 +2366,21 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2355 | intel_sdvo_connector->top_property = | 2366 | intel_sdvo_connector->top_property = |
2356 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2367 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2357 | "top_margin", 2); | 2368 | "top_margin", 2); |
2369 | if (!intel_sdvo_connector->top_property) | ||
2370 | return false; | ||
2371 | |||
2358 | intel_sdvo_connector->top_property->values[0] = 0; | 2372 | intel_sdvo_connector->top_property->values[0] = 0; |
2359 | intel_sdvo_connector->top_property->values[1] = data_value[0]; | 2373 | intel_sdvo_connector->top_property->values[1] = data_value[0]; |
2360 | drm_connector_attach_property(connector, | 2374 | drm_connector_attach_property(connector, |
2361 | intel_sdvo_connector->top_property, | 2375 | intel_sdvo_connector->top_property, |
2362 | intel_sdvo_connector->top_margin); | 2376 | intel_sdvo_connector->top_margin); |
2377 | |||
2363 | intel_sdvo_connector->bottom_property = | 2378 | intel_sdvo_connector->bottom_property = |
2364 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2379 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2365 | "bottom_margin", 2); | 2380 | "bottom_margin", 2); |
2381 | if (!intel_sdvo_connector->bottom_property) | ||
2382 | return false; | ||
2383 | |||
2366 | intel_sdvo_connector->bottom_property->values[0] = 0; | 2384 | intel_sdvo_connector->bottom_property->values[0] = 0; |
2367 | intel_sdvo_connector->bottom_property->values[1] = data_value[0]; | 2385 | intel_sdvo_connector->bottom_property->values[1] = data_value[0]; |
2368 | drm_connector_attach_property(connector, | 2386 | drm_connector_attach_property(connector, |
@@ -2388,6 +2406,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2388 | intel_sdvo_connector->hpos_property = | 2406 | intel_sdvo_connector->hpos_property = |
2389 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2407 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2390 | "hpos", 2); | 2408 | "hpos", 2); |
2409 | if (!intel_sdvo_connector->hpos_property) | ||
2410 | return false; | ||
2411 | |||
2391 | intel_sdvo_connector->hpos_property->values[0] = 0; | 2412 | intel_sdvo_connector->hpos_property->values[0] = 0; |
2392 | intel_sdvo_connector->hpos_property->values[1] = data_value[0]; | 2413 | intel_sdvo_connector->hpos_property->values[1] = data_value[0]; |
2393 | drm_connector_attach_property(connector, | 2414 | drm_connector_attach_property(connector, |
@@ -2413,6 +2434,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2413 | intel_sdvo_connector->vpos_property = | 2434 | intel_sdvo_connector->vpos_property = |
2414 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2435 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2415 | "vpos", 2); | 2436 | "vpos", 2); |
2437 | if (!intel_sdvo_connector->vpos_property) | ||
2438 | return false; | ||
2439 | |||
2416 | intel_sdvo_connector->vpos_property->values[0] = 0; | 2440 | intel_sdvo_connector->vpos_property->values[0] = 0; |
2417 | intel_sdvo_connector->vpos_property->values[1] = data_value[0]; | 2441 | intel_sdvo_connector->vpos_property->values[1] = data_value[0]; |
2418 | drm_connector_attach_property(connector, | 2442 | drm_connector_attach_property(connector, |
@@ -2438,6 +2462,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2438 | intel_sdvo_connector->saturation_property = | 2462 | intel_sdvo_connector->saturation_property = |
2439 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2463 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2440 | "saturation", 2); | 2464 | "saturation", 2); |
2465 | if (!intel_sdvo_connector->saturation_property) | ||
2466 | return false; | ||
2467 | |||
2441 | intel_sdvo_connector->saturation_property->values[0] = 0; | 2468 | intel_sdvo_connector->saturation_property->values[0] = 0; |
2442 | intel_sdvo_connector->saturation_property->values[1] = | 2469 | intel_sdvo_connector->saturation_property->values[1] = |
2443 | data_value[0]; | 2470 | data_value[0]; |
@@ -2462,6 +2489,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2462 | intel_sdvo_connector->contrast_property = | 2489 | intel_sdvo_connector->contrast_property = |
2463 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2490 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2464 | "contrast", 2); | 2491 | "contrast", 2); |
2492 | if (!intel_sdvo_connector->contrast_property) | ||
2493 | return false; | ||
2494 | |||
2465 | intel_sdvo_connector->contrast_property->values[0] = 0; | 2495 | intel_sdvo_connector->contrast_property->values[0] = 0; |
2466 | intel_sdvo_connector->contrast_property->values[1] = data_value[0]; | 2496 | intel_sdvo_connector->contrast_property->values[1] = data_value[0]; |
2467 | drm_connector_attach_property(connector, | 2497 | drm_connector_attach_property(connector, |
@@ -2485,6 +2515,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2485 | intel_sdvo_connector->hue_property = | 2515 | intel_sdvo_connector->hue_property = |
2486 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2516 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2487 | "hue", 2); | 2517 | "hue", 2); |
2518 | if (!intel_sdvo_connector->hue_property) | ||
2519 | return false; | ||
2520 | |||
2488 | intel_sdvo_connector->hue_property->values[0] = 0; | 2521 | intel_sdvo_connector->hue_property->values[0] = 0; |
2489 | intel_sdvo_connector->hue_property->values[1] = | 2522 | intel_sdvo_connector->hue_property->values[1] = |
2490 | data_value[0]; | 2523 | data_value[0]; |
@@ -2510,6 +2543,9 @@ static bool intel_sdvo_create_enhance_property(struct intel_sdvo *intel_sdvo, | |||
2510 | intel_sdvo_connector->brightness_property = | 2543 | intel_sdvo_connector->brightness_property = |
2511 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2544 | drm_property_create(dev, DRM_MODE_PROP_RANGE, |
2512 | "brightness", 2); | 2545 | "brightness", 2); |
2546 | if (!intel_sdvo_connector->brightness_property) | ||
2547 | return false; | ||
2548 | |||
2513 | intel_sdvo_connector->brightness_property->values[0] = 0; | 2549 | intel_sdvo_connector->brightness_property->values[0] = 0; |
2514 | intel_sdvo_connector->brightness_property->values[1] = | 2550 | intel_sdvo_connector->brightness_property->values[1] = |
2515 | data_value[0]; | 2551 | data_value[0]; |