aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_sdvo.c
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2014-02-11 10:12:50 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-02-14 05:25:07 -0500
commitc393454d701d6c0a6ee38d7479d4473962793f92 (patch)
treed6ba704aa3435343348dcabc490fe2940893331c /drivers/gpu/drm/i915/intel_sdvo.c
parent80f65de3c9b8101c1613fa82df500ba6a099a11c (diff)
drm/i915: sdvo: fix error path in sdvo_connector_init
Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Antti Koskipää <antti.koskipaa@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index cbc2feeda59d..08af4a195af8 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2381,16 +2381,22 @@ intel_sdvo_get_slave_addr(struct drm_device *dev, struct intel_sdvo *sdvo)
2381 return 0x72; 2381 return 0x72;
2382} 2382}
2383 2383
2384static void 2384static int
2385intel_sdvo_connector_init(struct intel_sdvo_connector *connector, 2385intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
2386 struct intel_sdvo *encoder) 2386 struct intel_sdvo *encoder)
2387{ 2387{
2388 drm_connector_init(encoder->base.base.dev, 2388 struct drm_connector *drm_connector;
2389 &connector->base.base, 2389 int ret;
2390
2391 drm_connector = &connector->base.base;
2392 ret = drm_connector_init(encoder->base.base.dev,
2393 drm_connector,
2390 &intel_sdvo_connector_funcs, 2394 &intel_sdvo_connector_funcs,
2391 connector->base.base.connector_type); 2395 connector->base.base.connector_type);
2396 if (ret < 0)
2397 return ret;
2392 2398
2393 drm_connector_helper_add(&connector->base.base, 2399 drm_connector_helper_add(drm_connector,
2394 &intel_sdvo_connector_helper_funcs); 2400 &intel_sdvo_connector_helper_funcs);
2395 2401
2396 connector->base.base.interlace_allowed = 1; 2402 connector->base.base.interlace_allowed = 1;
@@ -2400,7 +2406,16 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
2400 connector->base.unregister = intel_connector_unregister; 2406 connector->base.unregister = intel_connector_unregister;
2401 2407
2402 intel_connector_attach_encoder(&connector->base, &encoder->base); 2408 intel_connector_attach_encoder(&connector->base, &encoder->base);
2403 drm_sysfs_connector_add(&connector->base.base); 2409 ret = drm_sysfs_connector_add(drm_connector);
2410 if (ret < 0)
2411 goto err1;
2412
2413 return 0;
2414
2415err1:
2416 drm_connector_cleanup(drm_connector);
2417
2418 return ret;
2404} 2419}
2405 2420
2406static void 2421static void
@@ -2460,7 +2475,11 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2460 intel_sdvo->is_hdmi = true; 2475 intel_sdvo->is_hdmi = true;
2461 } 2476 }
2462 2477
2463 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2478 if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
2479 kfree(intel_sdvo_connector);
2480 return false;
2481 }
2482
2464 if (intel_sdvo->is_hdmi) 2483 if (intel_sdvo->is_hdmi)
2465 intel_sdvo_add_hdmi_properties(intel_sdvo, intel_sdvo_connector); 2484 intel_sdvo_add_hdmi_properties(intel_sdvo, intel_sdvo_connector);
2466 2485
@@ -2491,7 +2510,10 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
2491 2510
2492 intel_sdvo->is_tv = true; 2511 intel_sdvo->is_tv = true;
2493 2512
2494 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2513 if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
2514 kfree(intel_sdvo_connector);
2515 return false;
2516 }
2495 2517
2496 if (!intel_sdvo_tv_create_property(intel_sdvo, intel_sdvo_connector, type)) 2518 if (!intel_sdvo_tv_create_property(intel_sdvo, intel_sdvo_connector, type))
2497 goto err; 2519 goto err;
@@ -2535,8 +2557,11 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
2535 intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1; 2557 intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1;
2536 } 2558 }
2537 2559
2538 intel_sdvo_connector_init(intel_sdvo_connector, 2560 if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
2539 intel_sdvo); 2561 kfree(intel_sdvo_connector);
2562 return false;
2563 }
2564
2540 return true; 2565 return true;
2541} 2566}
2542 2567
@@ -2567,7 +2592,11 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
2567 intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; 2592 intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1;
2568 } 2593 }
2569 2594
2570 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2595 if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
2596 kfree(intel_sdvo_connector);
2597 return false;
2598 }
2599
2571 if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector)) 2600 if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector))
2572 goto err; 2601 goto err;
2573 2602