[PATCH] drm: Propagate failure from drm_modeset_register_all() on module load

Chris Wilson chris at chris-wilson.co.uk
Tue Nov 6 09:00:02 UTC 2018


If we fail to register all the initial CRTCs and connectors, report that
failure back to the caller.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_drv.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 36e8e9cbec52..25c0a5435dbb 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -822,8 +822,11 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 			goto err_minors;
 	}
 
-	if (drm_core_check_feature(dev, DRIVER_MODESET))
-		drm_modeset_register_all(dev);
+	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+		ret = drm_modeset_register_all(dev);
+		if (ret)
+			goto err_load;
+	}
 
 	ret = 0;
 
@@ -835,6 +838,10 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 
 	goto out_unlock;
 
+err_load:
+	if (dev->driver->unload)
+		dev->driver->unload(dev);
+	dev->registered = false;
 err_minors:
 	remove_compat_control_link(dev);
 	drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
-- 
2.19.1



More information about the dri-devel mailing list