diff options
author | Eric Anholt <eric@anholt.net> | 2017-03-28 16:13:43 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2017-03-30 11:41:38 -0400 |
commit | 6d6e500391875cc372336c88e9a8af377be19c36 (patch) | |
tree | ce8bbf7fced390702e7ddac11e96bd96a7014ea7 | |
parent | c02ed2e75ef4c74e41e421acb4ef1494671585e8 (diff) |
drm/vc4: Allocate the right amount of space for boot-time CRTC state.
Without this, the first modeset would dereference past the allocation
when trying to free the mm node.
Signed-off-by: Eric Anholt <eric@anholt.net>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170328201343.4884-1-eric@anholt.net
Fixes: d8dbf44f13b9 ("drm/vc4: Make the CRTCs cooperate on allocating display lists.")
Cc: <stable@vger.kernel.org> # v4.6+
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_crtc.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 0c06844af445..9fcf05ca492b 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c | |||
@@ -846,6 +846,17 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc, | |||
846 | drm_atomic_helper_crtc_destroy_state(crtc, state); | 846 | drm_atomic_helper_crtc_destroy_state(crtc, state); |
847 | } | 847 | } |
848 | 848 | ||
849 | static void | ||
850 | vc4_crtc_reset(struct drm_crtc *crtc) | ||
851 | { | ||
852 | if (crtc->state) | ||
853 | __drm_atomic_helper_crtc_destroy_state(crtc->state); | ||
854 | |||
855 | crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL); | ||
856 | if (crtc->state) | ||
857 | crtc->state->crtc = crtc; | ||
858 | } | ||
859 | |||
849 | static const struct drm_crtc_funcs vc4_crtc_funcs = { | 860 | static const struct drm_crtc_funcs vc4_crtc_funcs = { |
850 | .set_config = drm_atomic_helper_set_config, | 861 | .set_config = drm_atomic_helper_set_config, |
851 | .destroy = vc4_crtc_destroy, | 862 | .destroy = vc4_crtc_destroy, |
@@ -853,7 +864,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = { | |||
853 | .set_property = NULL, | 864 | .set_property = NULL, |
854 | .cursor_set = NULL, /* handled by drm_mode_cursor_universal */ | 865 | .cursor_set = NULL, /* handled by drm_mode_cursor_universal */ |
855 | .cursor_move = NULL, /* handled by drm_mode_cursor_universal */ | 866 | .cursor_move = NULL, /* handled by drm_mode_cursor_universal */ |
856 | .reset = drm_atomic_helper_crtc_reset, | 867 | .reset = vc4_crtc_reset, |
857 | .atomic_duplicate_state = vc4_crtc_duplicate_state, | 868 | .atomic_duplicate_state = vc4_crtc_duplicate_state, |
858 | .atomic_destroy_state = vc4_crtc_destroy_state, | 869 | .atomic_destroy_state = vc4_crtc_destroy_state, |
859 | .gamma_set = vc4_crtc_gamma_set, | 870 | .gamma_set = vc4_crtc_gamma_set, |