drm/radeon/kms/pm: fix segfault in clock code
authorAlex Deucher <alexdeucher@gmail.com>
Sun, 14 Mar 2010 20:31:36 +0000 (16:31 -0400)
committerDave Airlie <airlied@redhat.com>
Tue, 30 Mar 2010 23:53:46 +0000 (09:53 +1000)
Make sure we have a crtc assigned to the encoder
before dereferencing it.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
drivers/gpu/drm/radeon/radeon_pm.c

index 6458d52be4eeecbd48905c82cf89fef658c13172..a4b57493aa78cca3809558f3a428262f389a7837 100644 (file)
@@ -279,7 +279,8 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)
        list_for_each_entry(connector,
                &ddev->mode_config.connector_list, head) {
                if (connector->encoder &&
-                       connector->dpms != DRM_MODE_DPMS_OFF) {
+                   connector->encoder->crtc &&
+                   connector->dpms != DRM_MODE_DPMS_OFF) {
                        radeon_crtc = to_radeon_crtc(connector->encoder->crtc);
                        rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id);
                        ++count;