Commit 8007875f authored by Russell King's avatar Russell King Committed by Greg Kroah-Hartman

imx-drm: imx-drm-core: fix DRM cleanup paths

We must call drm_vblank_cleanup() on the error cleanup and unload paths
after we've had a successful call to drm_vblank_init().  Ensure that
the calls are in the reverse order to the initialisation order.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 82832046
...@@ -88,8 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm) ...@@ -88,8 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm)
imx_drm_device_put(); imx_drm_device_put();
drm_mode_config_cleanup(imxdrm->drm); drm_vblank_cleanup(imxdrm->drm);
drm_kms_helper_poll_fini(imxdrm->drm); drm_kms_helper_poll_fini(imxdrm->drm);
drm_mode_config_cleanup(imxdrm->drm);
return 0; return 0;
} }
...@@ -428,11 +429,11 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) ...@@ -428,11 +429,11 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
ret = drm_mode_group_init_legacy_group(imxdrm->drm, ret = drm_mode_group_init_legacy_group(imxdrm->drm,
&imxdrm->drm->primary->mode_group); &imxdrm->drm->primary->mode_group);
if (ret) if (ret)
goto err_init; goto err_kms;
ret = drm_vblank_init(imxdrm->drm, MAX_CRTC); ret = drm_vblank_init(imxdrm->drm, MAX_CRTC);
if (ret) if (ret)
goto err_init; goto err_kms;
/* /*
* with vblank_disable_allowed = true, vblank interrupt will be disabled * with vblank_disable_allowed = true, vblank interrupt will be disabled
...@@ -441,12 +442,19 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) ...@@ -441,12 +442,19 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
*/ */
imxdrm->drm->vblank_disable_allowed = true; imxdrm->drm->vblank_disable_allowed = true;
if (!imx_drm_device_get()) if (!imx_drm_device_get()) {
ret = -EINVAL; ret = -EINVAL;
goto err_vblank;
}
ret = 0; mutex_unlock(&imxdrm->mutex);
return 0;
err_init: err_vblank:
drm_vblank_cleanup(drm);
err_kms:
drm_kms_helper_poll_fini(drm);
drm_mode_config_cleanup(drm);
mutex_unlock(&imxdrm->mutex); mutex_unlock(&imxdrm->mutex);
return ret; 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