dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue()
@ 2025-02-19 13:08 Haoxiang Li
  2025-02-19 15:26 ` Jani Nikula
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2025-02-19 13:08 UTC (permalink / raw)
  To: jani.nikula, rodrigo.vivi, joonas.lahtinen, tursulin, airlied,
	simona, gustavo.sousa
  Cc: intel-gfx, intel-xe, dri-devel, linux-kernel, Haoxiang Li, stable

Add check for the return value of alloc_ordered_workqueue()
and alloc_workqueue() to catch potential exception.

Fixes: 40053823baad ("drm/i915/display: move modeset probe/remove functions to intel_display_driver.c")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 50ec0c3c7588..dfe5b779aefd 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -245,6 +245,11 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
 						WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
 	display->wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0);
 
+	if (!display->wq.modeset || !display->wq.flip || !display->wq.cleanup) {
+		ret = -ENOMEM;
+		goto cleanup_vga_client_pw_domain_dmc;
+	}
+
 	intel_mode_config_init(display);
 
 	ret = intel_cdclk_init(display);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue()
  2025-02-19 13:08 [PATCH] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Haoxiang Li
@ 2025-02-19 15:26 ` Jani Nikula
  0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2025-02-19 15:26 UTC (permalink / raw)
  To: Haoxiang Li, rodrigo.vivi, joonas.lahtinen, tursulin, airlied,
	simona, gustavo.sousa
  Cc: intel-gfx, intel-xe, dri-devel, linux-kernel, Haoxiang Li, stable

On Wed, 19 Feb 2025, Haoxiang Li <haoxiang_li2024@163.com> wrote:
> Add check for the return value of alloc_ordered_workqueue()
> and alloc_workqueue() to catch potential exception.
>
> Fixes: 40053823baad ("drm/i915/display: move modeset probe/remove functions to intel_display_driver.c")

Not really. That's just code movement.

> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_driver.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index 50ec0c3c7588..dfe5b779aefd 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -245,6 +245,11 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
>  						WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
>  	display->wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0);
>  
> +	if (!display->wq.modeset || !display->wq.flip || !display->wq.cleanup) {
> +		ret = -ENOMEM;
> +		goto cleanup_vga_client_pw_domain_dmc;
> +	}
> +

Yes, we should check these, but if some of them succeed and some fail,
we'll never destroy the workqueues whose allocation succeeded.

BR,
Jani.


>  	intel_mode_config_init(display);
>  
>  	ret = intel_cdclk_init(display);

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-19 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 13:08 [PATCH] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Haoxiang Li
2025-02-19 15:26 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).