intel_lvds_init() had a goto-based error path that manually called
drm_connector_cleanup(), drm_encoder_cleanup(), kfree() and
intel_connector_free() when no LVDS panel mode could be found.

Once drm_connector_init_with_ddc() and drm_encoder_init() have been
called, the DRM core takes ownership of these objects and will invoke
their .destroy callbacks (intel_connector_destroy and
intel_encoder_destroy) during device teardown. The manual cleanup in
the failed: label is therefore redundant.

Remove it and replace the goto with a simple early return.

Cc: [email protected]
Fixes: 79e539453b34e ("DRM: i915: add mode setting support")
Signed-off-by: Kory Maincent <[email protected]>
---

Not tested as I don't have such hardware.
---
 drivers/gpu/drm/i915/display/intel_lvds.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_lvds.c 
b/drivers/gpu/drm/i915/display/intel_lvds.c
index c8098104d853a..2a1301eda5fe5 100644
--- a/drivers/gpu/drm/i915/display/intel_lvds.c
+++ b/drivers/gpu/drm/i915/display/intel_lvds.c
@@ -990,8 +990,10 @@ void intel_lvds_init(struct intel_display *display)
        mutex_unlock(&display->drm->mode_config.mutex);
 
        /* If we still don't have a mode after all that, give up. */
-       if (!intel_panel_preferred_fixed_mode(connector))
-               goto failed;
+       if (!intel_panel_preferred_fixed_mode(connector)) {
+               drm_dbg_kms(display->drm, "No LVDS modes found, disabling.\n");
+               return;
+       }
 
        intel_panel_init(connector, drm_edid);
 
@@ -1004,12 +1006,4 @@ void intel_lvds_init(struct intel_display *display)
        lvds_encoder->a3_power = lvds & LVDS_A3_POWER_MASK;
 
        return;
-
-failed:
-       drm_dbg_kms(display->drm, "No LVDS modes found, disabling.\n");
-       drm_connector_cleanup(&connector->base);
-       drm_encoder_cleanup(&encoder->base);
-       kfree(lvds_encoder);
-       intel_connector_free(connector);
-       return;
 }

-- 
2.43.0

Reply via email to