From: Lu Yao <[email protected]> Fix two bugs in the probe error path:
1. intel_dmc_fini() was called on workqueue alloc failed paths but intel_dmc_init() had been invoked. Move the dmc init call advance. 2. If intel_mode_config_init() succeeded, after intel_xxx_init() failed leaked the resources allocated by drm_mode_config_init(). Add a cleanup_mode_config label. Signed-off-by: Lu Yao <[email protected]> --- .../drm/i915/display/intel_display_driver.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c index d0729936f681..d69bdfb19efe 100644 --- a/drivers/gpu/drm/i915/display/intel_display_driver.c +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c @@ -223,6 +223,8 @@ int intel_display_driver_probe_noirq(struct intel_display *display) if (!HAS_DISPLAY(display)) return 0; + intel_dmc_init(display); + display->hotplug.dp_wq = alloc_ordered_workqueue("intel-dp", 0); if (!display->hotplug.dp_wq) { ret = -ENOMEM; @@ -254,33 +256,31 @@ int intel_display_driver_probe_noirq(struct intel_display *display) goto cleanup_wq_cleanup; } - intel_dmc_init(display); - intel_mode_config_init(display); ret = intel_cdclk_init(display); if (ret) - goto cleanup_wq_unordered; + goto cleanup_mode_config; ret = intel_color_init(display); if (ret) - goto cleanup_wq_unordered; + goto cleanup_mode_config; ret = intel_dbuf_init(display); if (ret) - goto cleanup_wq_unordered; + goto cleanup_mode_config; ret = intel_dbuf_bw_init(display); if (ret) - goto cleanup_wq_unordered; + goto cleanup_mode_config; ret = intel_bw_init(display); if (ret) - goto cleanup_wq_unordered; + goto cleanup_mode_config; ret = intel_pmdemand_init(display); if (ret) - goto cleanup_wq_unordered; + goto cleanup_mode_config; intel_init_quirks(display); @@ -288,6 +288,8 @@ int intel_display_driver_probe_noirq(struct intel_display *display) return 0; +cleanup_mode_config: + intel_mode_config_cleanup(display); cleanup_wq_unordered: destroy_workqueue(display->wq.unordered); cleanup_wq_cleanup: -- 2.25.1
