summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorTomasz Figa <tfiga@chromium.org>2016-06-21 13:27:34 +0900
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-06-21 10:52:58 +0200
commit9127f99c4801f323ffbb3b755259f3a679f66c7c (patch)
tree60df493b2d714ac81a6cb0cf81e593f33f4e2489 /drivers/gpu/drm
parent41719d581a1e5ba8f4c5d0fc9181c3cd5bef5019 (diff)
drm/rockchip: Finish initialization before registering DRM device
Currently the driver calls drm_dev_register() directly after allocating the DRM device and then continues with further initialization. This is incorrect, because drm_dev_register() is supposed to be called after all initialization is done. This problem was masked by the fact that drm_dev_register() did not use to do anything special before, but recently it started to call drm_connector_register_all(), which leads to a crash if the driver is not fully initialized. This patch fixes the problem by moving the call to drm_dev_register() to the end of the initialization sequence and also removing the, now unnecessary, call to drm_connector_register_all() from driver code. Fixes: f706974a69b6 ("drm/rockchip: Drop drm_driver.load/unload callbacks") Signed-off-by: Tomasz Figa <tfiga@chromium.org> [danvet: Fix up cleanup labels a bit.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1466483254-35373-1-git-send-email-tfiga@chromium.org
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_drv.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index c2bcc5ea1abe..d665fb04d264 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -146,16 +146,12 @@ static int rockchip_drm_bind(struct device *dev)
if (!drm_dev)
return -ENOMEM;
- ret = drm_dev_register(drm_dev, 0);
- if (ret)
- goto err_free;
-
dev_set_drvdata(dev, drm_dev);
private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL);
if (!private) {
ret = -ENOMEM;
- goto err_unregister;
+ goto err_free;
}
drm_dev->dev_private = private;
@@ -197,12 +193,6 @@ static int rockchip_drm_bind(struct device *dev)
if (ret)
goto err_detach_device;
- ret = drm_connector_register_all(drm_dev);
- if (ret) {
- dev_err(dev, "failed to register connectors\n");
- goto err_unbind;
- }
-
/* init kms poll for handling hpd */
drm_kms_helper_poll_init(drm_dev);
@@ -222,14 +212,19 @@ static int rockchip_drm_bind(struct device *dev)
if (ret)
goto err_vblank_cleanup;
+ ret = drm_dev_register(drm_dev, 0);
+ if (ret)
+ goto err_fbdev_fini;
+
if (is_support_iommu)
arm_iommu_release_mapping(mapping);
return 0;
+err_fbdev_fini:
+ rockchip_drm_fbdev_fini(drm_dev);
err_vblank_cleanup:
drm_vblank_cleanup(drm_dev);
err_kms_helper_poll_fini:
drm_kms_helper_poll_fini(drm_dev);
-err_unbind:
component_unbind_all(dev, drm_dev);
err_detach_device:
if (is_support_iommu)
@@ -240,8 +235,6 @@ err_release_mapping:
err_config_cleanup:
drm_mode_config_cleanup(drm_dev);
drm_dev->dev_private = NULL;
-err_unregister:
- drm_dev_unregister(drm_dev);
err_free:
drm_dev_unref(drm_dev);
return ret;