[PATCH 2/2] drm/i915: Replace alloc*workqueue with DRM helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace alloc*workqueue with DRM helpers in order to avoid memory leak.
Moreover, check the return value since the workqueue may be NULL and
cause NULL pointer dereference.

Fixes: c26a058680dc ("drm/i915: Use a high priority wq for nonblocking plane updates")
Fixes: 757fffcfdffb ("drm/i915: Put all non-blocking modesets onto an ordered wq")
Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_display.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 6c2686ecb62a..8acef38ca985 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -41,6 +41,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fourcc.h>
+#include <drm/drm_managed.h>
 #include <drm/drm_privacy_screen_consumer.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_rect.h>
@@ -8654,9 +8655,16 @@ int intel_modeset_init_noirq(struct drm_i915_private *i915)
 
 	intel_dmc_ucode_init(i915);
 
-	i915->display.wq.modeset = alloc_ordered_workqueue("i915_modeset", 0);
-	i915->display.wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI |
-						WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
+	ret = drmm_alloc_ordered_workqueue(&i915->drm,
+					   i915->display.wq.modeset, "i915_modeset", 0);
+	if (ret)
+		goto cleanup_vga_client_pw_domain_dmc;
+
+	ret = drmm_alloc_workqueue(&i915->drm, i915->display.wq.flip,
+				   "i915_flip", WQ_HIGHPRI | WQ_UNBOUND,
+				   WQ_UNBOUND_MAX_ACTIVE);
+	if (ret)
+		goto cleanup_vga_client_pw_domain_dmc;
 
 	intel_mode_config_init(i915);
 
-- 
2.25.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux