瀏覽代碼

drm/nouveau/disp: fix oops in destructor with headless cards

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>
Maarten Lankhorst 11 年之前
父節點
當前提交
242a42eadf
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      drivers/gpu/drm/nouveau/core/engine/disp/base.c

+ 4 - 2
drivers/gpu/drm/nouveau/core/engine/disp/base.c

@@ -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);