Disabling the LTDC interrupt source during removal does not wait for
an already awakened IRQ thread. The thread can still access the DRM
device and its managed data after stm_drm_platform_remove() drops the
last device reference.
Release the managed IRQs in ltdc_unload() before the DRM device is put.
Fixes: b759012c5fa7 ("drm/stm: Add STM32 LTDC driver")
Signed-off-by: Guangshuo Li <[email protected]>
---
drivers/gpu/drm/stm/ltdc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 5311e0b3e8dc..35aa33f4c459 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -2103,8 +2103,15 @@ int ltdc_load(struct drm_device *ddev)
void ltdc_unload(struct drm_device *ddev)
{
+ struct platform_device *pdev = to_platform_device(ddev->dev);
+ struct ltdc_device *ldev = ddev->dev_private;
+ int i;
+
drm_dbg_driver(ddev, "\n");
+ for (i = 0; i < ldev->caps.nb_irq; i++)
+ devm_free_irq(ddev->dev, platform_get_irq(pdev, i), ddev);
+
pm_runtime_disable(ddev->dev);
}
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
--
2.43.0