diff options
author | James Ausmus <james.ausmus@intel.com> | 2017-10-13 14:01:44 -0400 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2017-10-17 11:23:30 -0400 |
commit | 091a4f91942a4396c67e5747f5cb38c6396d1fc5 (patch) | |
tree | 4126a3cef66b1154c15741c1e8d2b2b89a0d256c /drivers/gpu/drm/i915/intel_dp_mst.c | |
parent | 134649ff3545f3b7b862c589e9accb400ace2474 (diff) |
drm/i915: Handle drm-layer errors in intel_dp_add_mst_connector
Make intel_dp_add_mst_connector handle error returns from the drm_ calls.
Add intel_connector_free to support cleanup on the error path.
v2: Rename new function to avoid confusion, and simplify error
paths (Ville)
v3: Indentation fixup, style fixes (Ville)
v4: Clarify usage of intel_connector_free, and fix usage of
intel_connector_free
v5: Rebase
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: James Ausmus <james.ausmus@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013180144.15865-1-james.ausmus@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dp_mst.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp_mst.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index f7c782576162..772521440a9f 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c | |||
@@ -458,13 +458,20 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo | |||
458 | struct intel_connector *intel_connector; | 458 | struct intel_connector *intel_connector; |
459 | struct drm_connector *connector; | 459 | struct drm_connector *connector; |
460 | enum pipe pipe; | 460 | enum pipe pipe; |
461 | int ret; | ||
461 | 462 | ||
462 | intel_connector = intel_connector_alloc(); | 463 | intel_connector = intel_connector_alloc(); |
463 | if (!intel_connector) | 464 | if (!intel_connector) |
464 | return NULL; | 465 | return NULL; |
465 | 466 | ||
466 | connector = &intel_connector->base; | 467 | connector = &intel_connector->base; |
467 | drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort); | 468 | ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, |
469 | DRM_MODE_CONNECTOR_DisplayPort); | ||
470 | if (ret) { | ||
471 | intel_connector_free(intel_connector); | ||
472 | return NULL; | ||
473 | } | ||
474 | |||
468 | drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs); | 475 | drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs); |
469 | 476 | ||
470 | intel_connector->get_hw_state = intel_dp_mst_get_hw_state; | 477 | intel_connector->get_hw_state = intel_dp_mst_get_hw_state; |
@@ -472,15 +479,27 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo | |||
472 | intel_connector->port = port; | 479 | intel_connector->port = port; |
473 | 480 | ||
474 | for_each_pipe(dev_priv, pipe) { | 481 | for_each_pipe(dev_priv, pipe) { |
475 | drm_mode_connector_attach_encoder(&intel_connector->base, | 482 | struct drm_encoder *enc = |
476 | &intel_dp->mst_encoders[pipe]->base.base); | 483 | &intel_dp->mst_encoders[pipe]->base.base; |
484 | |||
485 | ret = drm_mode_connector_attach_encoder(&intel_connector->base, | ||
486 | enc); | ||
487 | if (ret) | ||
488 | goto err; | ||
477 | } | 489 | } |
478 | 490 | ||
479 | drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0); | 491 | drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0); |
480 | drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0); | 492 | drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0); |
481 | 493 | ||
482 | drm_mode_connector_set_path_property(connector, pathprop); | 494 | ret = drm_mode_connector_set_path_property(connector, pathprop); |
495 | if (ret) | ||
496 | goto err; | ||
497 | |||
483 | return connector; | 498 | return connector; |
499 | |||
500 | err: | ||
501 | drm_connector_cleanup(connector); | ||
502 | return NULL; | ||
484 | } | 503 | } |
485 | 504 | ||
486 | static void intel_dp_register_mst_connector(struct drm_connector *connector) | 505 | static void intel_dp_register_mst_connector(struct drm_connector *connector) |