From: Heiko Stuebner Date: Thu, 20 Feb 2025 23:41:41 +0000 (+0100) Subject: drm/rockchip: Fix shutdown when no drm-device is set up X-Git-Tag: v6.15-rc1~120^2~13^2~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4444e4d789d64f053435713e5984f0ef31a7633b;p=thirdparty%2Fkernel%2Flinux.git drm/rockchip: Fix shutdown when no drm-device is set up When the drm-driver probes, it mainly creates the component device, where all the sub-drivers (vops, hdmi, etc) hook into. This will cause the shutdown handler to get called on shutdown, even though the drm-device might not have been set up, or the component bind might have failed. So use the new component helper to check whether the drm-device is up and only then call the drm-atomic helper to release all the drm magic. This prevents failures when the drm-device is never set, or has been freed up already for example by a probe-defer during the component bind. Reviewed-by: Nicolas Frattaroli Tested-by: Nicolas Frattaroli Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20250220234141.2788785-3-heiko@sntech.de --- diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 439edc165ff68..180fad5d49ad3 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -484,9 +484,11 @@ static void rockchip_drm_platform_remove(struct platform_device *pdev) static void rockchip_drm_platform_shutdown(struct platform_device *pdev) { - struct drm_device *drm = platform_get_drvdata(pdev); + if (component_master_is_bound(&pdev->dev, &rockchip_drm_ops)) { + struct drm_device *drm = platform_get_drvdata(pdev); - drm_atomic_helper_shutdown(drm); + drm_atomic_helper_shutdown(drm); + } } static const struct of_device_id rockchip_drm_dt_ids[] = {