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

38 lines
1.1 KiB
Diff

From 41c3a74347f9d6dad0160b570601dc0c05511509 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 24 Sep 2022 21:54:23 +0200
Subject: [PATCH 184/389] 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 813f9f8c8698..bef501d49ef6 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.35.3