mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/gma500: Balance MSI and IRQ state on installation failure
@ 2026-09-15  1:27 Myeonghun Pak
  0 siblings, 0 replies; only message in thread
From: Myeonghun Pak @ 2026-09-15  1:27 UTC (permalink / raw)
  To: Patrik Jakobsson
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, dri-devel, linux-kernel, stable

gma_irq_install() leaves MSI enabled when requesting the IRQ fails.
Disable MSI on failed installation and clear irq_enabled on uninstall,
so an unsuccessful reinstall after suspend does not leave stale state
that makes a later uninstall free an unregistered IRQ.

This issue was identified during our ongoing static-analysis research
while reviewing kernel code.

Fixes: 9b6a16575ebf ("drm/gma500: Fix (vblank) IRQs not working after suspend/resume")
Fixes: da596080b2b4 ("drm/gma500: Fix call trace when psb_gem_mm_init() fails")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/gpu/drm/gma500/psb_irq.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -316,15 +316,17 @@ int gma_irq_install(struct drm_device *dev)
 		dev_priv->use_msi = false;
 	}
 
-	if (pdev->irq == IRQ_NOTCONNECTED)
-		return -ENOTCONN;
+	if (pdev->irq == IRQ_NOTCONNECTED) {
+		ret = -ENOTCONN;
+		goto err_disable_msi;
+	}
 
 	gma_irq_preinstall(dev);
 
 	/* PCI devices require shared interrupts. */
 	ret = request_irq(pdev->irq, gma_irq_handler, IRQF_SHARED, dev->driver->name, dev);
 	if (ret)
-		return ret;
+		goto err_disable_msi;
 
 	gma_irq_postinstall(dev);
 
@@ -332,5 +334,10 @@ int gma_irq_install(struct drm_device *dev)
 
 	return 0;
+
+err_disable_msi:
+	if (dev_priv->use_msi)
+		pci_disable_msi(pdev);
+	return ret;
 }
 
 void gma_irq_uninstall(struct drm_device *dev)
@@ -373,6 +380,7 @@ void gma_irq_uninstall(struct drm_device *dev)
 	free_irq(pdev->irq, dev);
 	if (dev_priv->use_msi)
 		pci_disable_msi(pdev);
+	dev_priv->irq_enabled = false;
 }
 
 int gma_crtc_enable_vblank(struct drm_crtc *crtc)
-- 
2.51.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-15  1:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15  1:27 [PATCH] drm/gma500: Balance MSI and IRQ state on installation failure Myeonghun Pak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®