[PATCH] drm/rockchip: Fix panic on reboot when DRM device fails to bind

Ondřej Jirman <[email protected]>
Newsgroups org.infradead.lists.linux-rockchip,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: Ondrej Jirman <[email protected]>

When DRM device is freed, we need to clear the drvdata pointer, because
it now points to invalid memory.

Signed-off-by: Ondrej Jirman <[email protected]>
---
 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 3099408e9d05..8b9992843162 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -210,6 +210,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;
 }
 
@@ -226,6 +227,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.54.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.