All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/omap: check IRQ wait allocation
@ 2026-06-06  4:06 Ruoyu Wang
  2026-06-06  4:18 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Ruoyu Wang @ 2026-06-06  4:06 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, Ruoyu Wang

omap_irq_wait_init() allocates an omap_irq_wait object and initializes
its waitqueue and list node immediately. If the allocation fails, the
waitqueue initialization dereferences NULL.

Return NULL when the wait object cannot be allocated and make
omap_irq_wait() report -ENOMEM if it is asked to wait on a missing
object. No wait entry has been installed in that case, so there is
nothing to remove from the wait list.

Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
 drivers/gpu/drm/omapdrm/omap_irq.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index d0f895c43ee41..e0fa9617a3d30 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -46,6 +46,9 @@ struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev,
 	struct omap_irq_wait *wait = kzalloc_obj(*wait);
 	unsigned long flags;
 
+	if (!wait)
+		return NULL;
+
 	init_waitqueue_head(&wait->wq);
 	wait->irqmask = irqmask;
 	wait->count = count;
@@ -65,6 +68,9 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
 	unsigned long flags;
 	int ret;
 
+	if (!wait)
+		return -ENOMEM;
+
 	ret = wait_event_timeout(wait->wq, (wait->count <= 0), timeout);
 
 	spin_lock_irqsave(&priv->wait_lock, flags);
-- 
2.34.1


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

end of thread, other threads:[~2026-06-06  4:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-06  4:06 [PATCH] drm/omap: check IRQ wait allocation Ruoyu Wang
2026-06-06  4:18 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.