Commit 633873e6 authored by Emil Velikov's avatar Emil Velikov Committed by Emil Velikov

drm/vkms: provide a parent device to drm_dev_init()

Earlier commit updated the vgem driver to improve the topology, by
passing a platform device as parent to drm_dev_init(). Shortly
afterwords we updated the core function to BUG() in order to catch any
buggy drivers passing NULL as parent.

While I missed the vkms driver (as the patch predates vkms by a few
months), the BUG caught the issue within couple of hours.

Swap the drm_dev_init <> platform_device_register_simple order, to
the driver back to life.

Fixes: f08877e7 ("drm: BUG_ON if passing NULL parent to drm_dev_init")
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Deepak Sharma <deepak.sharma@amd.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reported-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181026100550.625-1-emil.l.velikov@gmail.com
parent 47164e0b
......@@ -108,17 +108,18 @@ static int __init vkms_init(void)
if (!vkms_device)
return -ENOMEM;
ret = drm_dev_init(&vkms_device->drm, &vkms_driver, NULL);
if (ret)
goto out_free;
vkms_device->platform =
platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
if (IS_ERR(vkms_device->platform)) {
ret = PTR_ERR(vkms_device->platform);
goto out_fini;
goto out_free;
}
ret = drm_dev_init(&vkms_device->drm, &vkms_driver,
&vkms_device->platform->dev);
if (ret)
goto out_unregister;
vkms_device->drm.irq_enabled = true;
ret = drm_vblank_init(&vkms_device->drm, 1);
......@@ -129,20 +130,20 @@ static int __init vkms_init(void)
ret = vkms_modeset_init(vkms_device);
if (ret)
goto out_unregister;
goto out_fini;
ret = drm_dev_register(&vkms_device->drm, 0);
if (ret)
goto out_unregister;
goto out_fini;
return 0;
out_unregister:
platform_device_unregister(vkms_device->platform);
out_fini:
drm_dev_fini(&vkms_device->drm);
out_unregister:
platform_device_unregister(vkms_device->platform);
out_free:
kfree(vkms_device);
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment