Skip to contentSkip to conversation

drm/i915: free crtc on driver remove

PATCH Superseded Arun R Murthy 1 participant 2 messages Jun 30, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: free crtc on driver remove

intel_crtc is being allocated as part of intel_modeset_init_nogem and not freed as part of driver remove. This will lead to memory leak. Hence free up the allocated crtc on driver remove as part of intel_modeset_driver_remove_nogem.

---
 drivers/gpu/drm/i915/display/intel_display.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +6 -0
index a0f84cbe974f..33e29455fe56 100644
@@ -9046,6 +9046,8 @@ void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915)
 /* part #3: call after gem init */
 void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915)
 {
+	struct intel_crtc *crtc;
+
 	intel_dmc_ucode_fini(i915);
 
 	intel_power_domains_driver_remove(i915);
@@ -9053,6 +9055,10 @@ void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915)
 	intel_vga_unregister(i915);
 
 	intel_bios_driver_remove(i915);
+
+	/* Free the allocated crtc */
+	for_each_intel_crtc(&i915->drm, crtc)
+		intel_crtc_free(crtc);
 }
 
 bool intel_modeset_probe_defer(struct pci_dev *pdev)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 7 lines

intel_crtc is being allocated as part of intel_modeset_init_nogem and not freed as part of driver remove. This will lead to memory leak. Hence free up the allocated crtc on driver remove as part of intel_modeset_driver_remove_nogem.

---

Please discard this version, accidently sent a wrong patch, floated the right patch under v2.

Thanks and Regards,
Arun R Murthy
-------------------