In hdlcd_drm_bind()/hdlcd_drm_unbind() we unwind the DRM setup in the wrong order (drm_mode_config_cleanup() before connector and encoder had a chance to cleanup their memory or before drm_dev_unregister()). The correct order should match in both functions. Reported-by: Robin Murphy <Robin.Murphy@xxxxxxx> Signed-off-by: Liviu Dudau <Liviu.Dudau@xxxxxxx> --- Robin, I believe this should fix your problems with HDLCD failing to allocate CMA memory and then crashing. Best regards, Liviu drivers/gpu/drm/arm/hdlcd_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 3422ca2..2c6eddb 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -382,7 +382,6 @@ static int hdlcd_drm_bind(struct device *dev) err_fbdev: drm_kms_helper_poll_fini(drm); - drm_mode_config_cleanup(drm); drm_vblank_cleanup(drm); err_vblank: pm_runtime_disable(drm->dev); @@ -390,6 +389,7 @@ err_pm_active: component_unbind_all(dev, drm); err_unregister: drm_dev_unregister(drm); + drm_mode_config_cleanup(drm); err_unload: drm_irq_uninstall(drm); of_reserved_mem_device_release(drm->dev); @@ -410,15 +410,15 @@ static void hdlcd_drm_unbind(struct device *dev) hdlcd->fbdev = NULL; } drm_kms_helper_poll_fini(drm); - component_unbind_all(dev, drm); drm_vblank_cleanup(drm); + component_unbind_all(dev, drm); pm_runtime_get_sync(drm->dev); drm_irq_uninstall(drm); pm_runtime_put_sync(drm->dev); pm_runtime_disable(drm->dev); - of_reserved_mem_device_release(drm->dev); - drm_mode_config_cleanup(drm); drm_dev_unregister(drm); + drm_mode_config_cleanup(drm); + of_reserved_mem_device_release(drm->dev); drm_dev_unref(drm); drm->dev_private = NULL; dev_set_drvdata(dev, NULL); -- 2.8.2 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel