diff mbox

[2/4] drm/omap: fix uninit order in pdev_remove()

Message ID 1396442280-6189-2-git-send-email-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomi Valkeinen April 2, 2014, 12:37 p.m. UTC
When unloading omapdrm driver, the omapdrm platform device is
uninitialized last, after the displays have been disconnected omap_crtc
callbacks have been removed. As the omapdrm pdev uninitialization needs
the features uninitialized in earlier steps, a crash is guaranteed.

This patch fixes the uninitialize order so that the omapdrm pdev is
removed first.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Rob Clark April 2, 2014, 2:16 p.m. UTC | #1
On Wed, Apr 2, 2014 at 8:37 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> When unloading omapdrm driver, the omapdrm platform device is
> uninitialized last, after the displays have been disconnected omap_crtc
> callbacks have been removed. As the omapdrm pdev uninitialization needs
> the features uninitialized in earlier steps, a crash is guaranteed.
>
> This patch fixes the uninitialize order so that the omapdrm pdev is
> removed first.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Rob Clark <robdclark@gmail.com

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index bf39fcc49e0f..df3e66416a30 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -696,10 +696,11 @@ static int pdev_remove(struct platform_device *device)
>  {
>         DBG("");
>
> +       drm_put_dev(platform_get_drvdata(device));
> +
>         omap_disconnect_dssdevs();
>         omap_crtc_pre_uninit();
>
> -       drm_put_dev(platform_get_drvdata(device));
>         return 0;
>  }
>
> --
> 1.8.3.2
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index bf39fcc49e0f..df3e66416a30 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -696,10 +696,11 @@  static int pdev_remove(struct platform_device *device)
 {
 	DBG("");
 
+	drm_put_dev(platform_get_drvdata(device));
+
 	omap_disconnect_dssdevs();
 	omap_crtc_pre_uninit();
 
-	drm_put_dev(platform_get_drvdata(device));
 	return 0;
 }