drm/i915: Simplify error handling in intel_modeset_all_pipes()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 14 Nov 2016 16:35:11 +0000 (18:35 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 23 Nov 2016 20:21:26 +0000 (22:21 +0200)
No need for the extra break statements and whatnot, just return the
error directly. And tighten the scope of the local variables while at
it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1479141311-11904-4-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c

index 8290ca9..d51d885 100644 (file)
@@ -13933,14 +13933,15 @@ static int intel_lock_all_pipes(struct drm_atomic_state *state)
 static int intel_modeset_all_pipes(struct drm_atomic_state *state)
 {
        struct drm_crtc *crtc;
-       struct drm_crtc_state *crtc_state;
-       int ret = 0;
 
        /*
         * Add all pipes to the state, and force
         * a modeset on all the active ones.
         */
        for_each_crtc(state->dev, crtc) {
+               struct drm_crtc_state *crtc_state;
+               int ret;
+
                crtc_state = drm_atomic_get_crtc_state(state, crtc);
                if (IS_ERR(crtc_state))
                        return PTR_ERR(crtc_state);
@@ -13952,14 +13953,14 @@ static int intel_modeset_all_pipes(struct drm_atomic_state *state)
 
                ret = drm_atomic_add_affected_connectors(state, crtc);
                if (ret)
-                       break;
+                       return ret;
 
                ret = drm_atomic_add_affected_planes(state, crtc);
                if (ret)
-                       break;
+                       return ret;
        }
 
-       return ret;
+       return 0;
 }
 
 static int intel_modeset_checks(struct drm_atomic_state *state)