drm/plane-helper: Test for plane disable earlier
authorMatt Roper <matthew.d.roper@intel.com>
Thu, 11 Dec 2014 15:20:57 +0000 (07:20 -0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 11 Dec 2014 15:57:18 +0000 (16:57 +0100)
drm_plane_helper_check_update() currently uses crtc before testing whether
we're disabling the plane (fb == NULL).  Move the fb test before the first crtc
usage so that crtc == NULL doesn't have to be handled by the caller.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_plane_helper.c

index 18a1ac6ac22f396aa55b34187b7fb89a9392613b..391dfb7d1086e808c01d21d4f67db56285613d43 100644 (file)
@@ -142,6 +142,17 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
 {
        int hscale, vscale;
 
+       if (!fb) {
+               *visible = false;
+               return 0;
+       }
+
+       /* crtc should only be NULL when disabling (i.e., !fb) */
+       if (WARN_ON(!crtc)) {
+               *visible = false;
+               return 0;
+       }
+
        if (!crtc->enabled && !can_update_disabled) {
                DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
                return -EINVAL;
@@ -155,11 +166,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
                return -ERANGE;
        }
 
-       if (!fb) {
-               *visible = false;
-               return 0;
-       }
-
        *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
        if (!*visible)
                /*