drm: Check for a NULL encoder when reverting on error path
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 11 Feb 2009 16:39:21 +0000 (16:39 +0000)
committerDave Airlie <airlied@redhat.com>
Fri, 20 Feb 2009 02:21:12 +0000 (12:21 +1000)
We need to skip the connectors with a NULL encoder to match the success
path and avoid an OOPS.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/gpu/drm/drm_crtc_helper.c

index 964c5eb1fada4266795056abbad038ac23463dd7..8ba22c039a1172d38d0bab99f8c004fba76fa7e4 100644 (file)
@@ -775,8 +775,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
 fail_set_mode:
        set->crtc->enabled = save_enabled;
        count = 0;
-       list_for_each_entry(connector, &dev->mode_config.connector_list, head)
+       list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+               if (!connector->encoder)
+                       continue;
+
                connector->encoder->crtc = save_crtcs[count++];
+       }
 fail_no_encoder:
        kfree(save_crtcs);
        count = 0;