drm/gma500: Balance MSI and IRQ state on installation failure
Subsystems (4)
PATCH 1/1 drm/gma500: Balance MSI and IRQ state on installation failure
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")
Assisted-by LLM
Co-developed-by Ijae Kim <[email protected]>
Signed-off-by Ijae Kim <[email protected]>
Signed-off-by Myeonghun Pak <[email protected]>
--- drivers/gpu/drm/gma500/psb_irq.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/gma500/psb_irq.c +11 -3
@@ -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)
Signature · 1 line
2.51.0