drm/mediatek: Use drm_atomic destroy_state helpers
authorBibby Hsieh <bibby.hsieh@mediatek.com>
Thu, 4 Aug 2016 02:59:54 +0000 (10:59 +0800)
committerSean Paul <seanpaul@chromium.org>
Mon, 8 Aug 2016 18:20:01 +0000 (14:20 -0400)
Use the core destroy_state helpers to destroy core state to ensure we don't
leak if/when more fields get added later.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1470279597-60453-5-git-send-email-bibby.hsieh@mediatek.com
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
drivers/gpu/drm/mediatek/mtk_drm_plane.c

index d6fbefa6561996fbe0ed4ca09d5677c7e04d24ce..733b2a3643de200e0f2a34f546961409b10d5b9b 100644 (file)
@@ -112,8 +112,7 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)
        struct mtk_crtc_state *state;
 
        if (crtc->state) {
-               if (crtc->state->mode_blob)
-                       drm_property_unreference_blob(crtc->state->mode_blob);
+               __drm_atomic_helper_crtc_destroy_state(crtc->state);
 
                state = to_mtk_crtc_state(crtc->state);
                memset(state, 0, sizeof(*state));
index 86b7aedcb2c11f88870f52831c7314d43a77e143..17172ba40959cb937d36558d27853ea93136e735 100644 (file)
@@ -73,8 +73,7 @@ static void mtk_plane_reset(struct drm_plane *plane)
        struct mtk_plane_state *state;
 
        if (plane->state) {
-               if (plane->state->fb)
-                       drm_framebuffer_unreference(plane->state->fb);
+               __drm_atomic_helper_plane_destroy_state(plane->state);
 
                state = to_mtk_plane_state(plane->state);
                memset(state, 0, sizeof(*state));