From bae2790f627eb30ec3845167341b108e13328f6f Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sun, 7 Aug 2022 10:46:43 -0500
Subject: [PATCH 084/117] drm/sun4i: dsi: Allow panel attach before card
 registration

Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -967,13 +967,12 @@ static int sun6i_dsi_attach(struct mipi_
 
 	if (IS_ERR(panel))
 		return PTR_ERR(panel);
-	if (!dsi->drm || !dsi->drm->registered)
-		return -EPROBE_DEFER;
 
 	dsi->panel = panel;
 	dsi->device = device;
 
-	drm_kms_helper_hotplug_event(dsi->drm);
+	if (dsi->drm && dsi->drm->registered)
+		drm_kms_helper_hotplug_event(dsi->drm);
 
 	dev_info(host->dev, "Attached device %s\n", device->name);
 
@@ -988,7 +987,8 @@ static int sun6i_dsi_detach(struct mipi_
 	dsi->panel = NULL;
 	dsi->device = NULL;
 
-	drm_kms_helper_hotplug_event(dsi->drm);
+	if (dsi->drm && dsi->drm->registered)
+		drm_kms_helper_hotplug_event(dsi->drm);
 
 	return 0;
 }
