From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date: Tue, 23 Jul 2013 13:45:11 +0000 (+0200)
Subject: drm/nouveau: fix null pointer dereference in poll_changed
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8a258353ed46fa9886bff42e869067336eeb1db6;p=linux.git

drm/nouveau: fix null pointer dereference in poll_changed

Fixes vgaswitcheroo on a card without display.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
---

diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 4c1bc061fae2c..8f6d63d7edd31 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -398,7 +398,8 @@ void
 nouveau_fbcon_output_poll_changed(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	drm_fb_helper_hotplug_event(&drm->fbcon->helper);
+	if (drm->fbcon)
+		drm_fb_helper_hotplug_event(&drm->fbcon->helper);
 }
 
 static int