aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2017-03-28 16:13:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-08 03:30:35 -0400
commit6acf5207085723e7a98233b3b6a02ecc4e6ab6cb (patch)
treed25e58e3ce52e323c892ae3f0a49f708e899415d /drivers/gpu
parentfa68e1d3cecc2f25c7ac0615950232b509121689 (diff)
drm/vc4: Allocate the right amount of space for boot-time CRTC state.
commit 6d6e500391875cc372336c88e9a8af377be19c36 upstream. 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.") Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/vc4/vc4_crtc.c13
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 7aadce1f7e7a..c7e6c9839c9a 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -842,6 +842,17 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,
842 drm_atomic_helper_crtc_destroy_state(crtc, state); 842 drm_atomic_helper_crtc_destroy_state(crtc, state);
843} 843}
844 844
845static void
846vc4_crtc_reset(struct drm_crtc *crtc)
847{
848 if (crtc->state)
849 __drm_atomic_helper_crtc_destroy_state(crtc->state);
850
851 crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
852 if (crtc->state)
853 crtc->state->crtc = crtc;
854}
855
845static const struct drm_crtc_funcs vc4_crtc_funcs = { 856static const struct drm_crtc_funcs vc4_crtc_funcs = {
846 .set_config = drm_atomic_helper_set_config, 857 .set_config = drm_atomic_helper_set_config,
847 .destroy = vc4_crtc_destroy, 858 .destroy = vc4_crtc_destroy,
@@ -849,7 +860,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
849 .set_property = NULL, 860 .set_property = NULL,
850 .cursor_set = NULL, /* handled by drm_mode_cursor_universal */ 861 .cursor_set = NULL, /* handled by drm_mode_cursor_universal */
851 .cursor_move = NULL, /* handled by drm_mode_cursor_universal */ 862 .cursor_move = NULL, /* handled by drm_mode_cursor_universal */
852 .reset = drm_atomic_helper_crtc_reset, 863 .reset = vc4_crtc_reset,
853 .atomic_duplicate_state = vc4_crtc_duplicate_state, 864 .atomic_duplicate_state = vc4_crtc_duplicate_state,
854 .atomic_destroy_state = vc4_crtc_destroy_state, 865 .atomic_destroy_state = vc4_crtc_destroy_state,
855 .gamma_set = vc4_crtc_gamma_set, 866 .gamma_set = vc4_crtc_gamma_set,