drm/crtc_helper: avoid NULL-pointer dereference when encoder is NULL
authorMaarten Maathuis <madman2003@gmail.com>
Tue, 1 Sep 2009 01:39:04 +0000 (03:39 +0200)
committerDave Airlie <airlied@linux.ie>
Wed, 2 Sep 2009 06:28:56 +0000 (16:28 +1000)
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/gpu/drm/drm_crtc_helper.c

index db0237dec6c444ca6b1a744ea5e7eececf1a66b9..e7e6c25b560c28ffc9b7a32705fc0bbf7f129e8b 100644 (file)
@@ -842,7 +842,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
                        /* If the encoder is reused for another connector, then
                         * the appropriate crtc will be set later.
                         */
-                       connector->encoder->crtc = NULL;
+                       if (connector->encoder)
+                               connector->encoder->crtc = NULL;
                        connector->encoder = new_encoder;
                }
        }