This code was in drm_plane_helper, but missing from drm_atomic_helper,
causing various crashes when the plane was already disabled. Just copy
over the quick return there to prevent a crash.

Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>
Reviewed-by: Rob Clark <robdclark at gmail.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/drm_atomic_helper.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index fad2b93..d96dac3 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1246,6 +1246,11 @@ int drm_atomic_helper_disable_plane(struct drm_plane 
*plane)
        struct drm_plane_state *plane_state;
        int ret = 0;

+       /* crtc helpers love to call disable functions for already disabled hw
+        * functions. So cope with that. */
+       if (!plane->crtc)
+               return 0;
+
        state = drm_atomic_state_alloc(plane->dev);
        if (!state)
                return -ENOMEM;
-- 
2.1.0

Reply via email to