drm/nouveau/disp: fix oops in destructor with headless cards
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>
Tue, 17 Jun 2014 13:01:48 +0000 (15:01 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 18 Jun 2014 05:49:50 +0000 (15:49 +1000)
If init doesn't run then disp->outp might not be initialized, resulting
in an oops.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/disp/base.c

index c41f656abe64cfaab5225fc49a67234c618f97bb..9c38c5e40500004144c399c4a349bf8d2a23db7d 100644 (file)
@@ -99,8 +99,10 @@ _nouveau_disp_dtor(struct nouveau_object *object)
 
        nouveau_event_destroy(&disp->vblank);
 
-       list_for_each_entry_safe(outp, outt, &disp->outp, head) {
-               nouveau_object_ref(NULL, (struct nouveau_object **)&outp);
+       if (disp->outp.next) {
+               list_for_each_entry_safe(outp, outt, &disp->outp, head) {
+                       nouveau_object_ref(NULL, (struct nouveau_object **)&outp);
+               }
        }
 
        nouveau_engine_destroy(&disp->base);