diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-12-16 06:33:44 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-17 20:09:52 -0500 |
commit | 8007875f0619f36d885ba357b587e673d6f20704 (patch) | |
tree | b3777c055cc031278bee1f36ca6463410075346e | |
parent | 82832046e285952f14e707647f9ef82466c883cc (diff) |
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: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/imx-drm/imx-drm-core.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index b5ff45f3c55b..aff4bd47693e 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c | |||
@@ -88,8 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm) | |||
88 | 88 | ||
89 | imx_drm_device_put(); | 89 | imx_drm_device_put(); |
90 | 90 | ||
91 | drm_mode_config_cleanup(imxdrm->drm); | 91 | drm_vblank_cleanup(imxdrm->drm); |
92 | drm_kms_helper_poll_fini(imxdrm->drm); | 92 | drm_kms_helper_poll_fini(imxdrm->drm); |
93 | drm_mode_config_cleanup(imxdrm->drm); | ||
93 | 94 | ||
94 | return 0; | 95 | return 0; |
95 | } | 96 | } |
@@ -428,11 +429,11 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) | |||
428 | ret = drm_mode_group_init_legacy_group(imxdrm->drm, | 429 | ret = drm_mode_group_init_legacy_group(imxdrm->drm, |
429 | &imxdrm->drm->primary->mode_group); | 430 | &imxdrm->drm->primary->mode_group); |
430 | if (ret) | 431 | if (ret) |
431 | goto err_init; | 432 | goto err_kms; |
432 | 433 | ||
433 | ret = drm_vblank_init(imxdrm->drm, MAX_CRTC); | 434 | ret = drm_vblank_init(imxdrm->drm, MAX_CRTC); |
434 | if (ret) | 435 | if (ret) |
435 | goto err_init; | 436 | goto err_kms; |
436 | 437 | ||
437 | /* | 438 | /* |
438 | * with vblank_disable_allowed = true, vblank interrupt will be disabled | 439 | * 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 | */ | 442 | */ |
442 | imxdrm->drm->vblank_disable_allowed = true; | 443 | imxdrm->drm->vblank_disable_allowed = true; |
443 | 444 | ||
444 | if (!imx_drm_device_get()) | 445 | if (!imx_drm_device_get()) { |
445 | ret = -EINVAL; | 446 | ret = -EINVAL; |
447 | goto err_vblank; | ||
448 | } | ||
446 | 449 | ||
447 | ret = 0; | 450 | mutex_unlock(&imxdrm->mutex); |
451 | return 0; | ||
448 | 452 | ||
449 | err_init: | 453 | err_vblank: |
454 | drm_vblank_cleanup(drm); | ||
455 | err_kms: | ||
456 | drm_kms_helper_poll_fini(drm); | ||
457 | drm_mode_config_cleanup(drm); | ||
450 | mutex_unlock(&imxdrm->mutex); | 458 | mutex_unlock(&imxdrm->mutex); |
451 | 459 | ||
452 | return ret; | 460 | return ret; |