build/patch/kernel/archive/sunxi-6.5/patches.megous/drm-rockchip-Fix-panic-on-reboot-when-DRM-device-fails-to-bind.patch

38 lines
1.1 KiB
Diff
Raw Normal View History

From 914eef5d061f59d30e01affb87f0dd4905687bda Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 24 Sep 2022 21:54:23 +0200
Subject: [PATCH 194/464] drm: rockchip: Fix panic on reboot when DRM device
fails to bind
When DRM device is freed, we need to clear the drvdata pointer, because
it now points to invalid memory.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index d97f2edc646b..ee2ebbba493b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -201,6 +201,7 @@ static int rockchip_drm_bind(struct device *dev)
component_unbind_all(dev, drm_dev);
err_free:
drm_dev_put(drm_dev);
+ dev_set_drvdata(dev, NULL);
return ret;
}
@@ -217,6 +218,7 @@ static void rockchip_drm_unbind(struct device *dev)
rockchip_iommu_cleanup(drm_dev);
drm_dev_put(drm_dev);
+ dev_set_drvdata(dev, NULL);
}
DEFINE_DRM_GEM_FOPS(rockchip_drm_driver_fops);
--
2.34.1