[Nouveau] [PATCH 1/3] drm/nouveau/led: don't access led subdev if it wasn't initialized

Martin Peres martin.peres at free.fr
Fri Sep 16 07:34:42 UTC 2016


From: Karol Herbst <karolherbst at gmail.com>

Fixes a kernel crash on suspend/resume.
---
 drm/nouveau/nouveau_led.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drm/nouveau/nouveau_led.c b/drm/nouveau/nouveau_led.c
index 9eed5a6..5e28b5f 100644
--- a/drm/nouveau/nouveau_led.c
+++ b/drm/nouveau/nouveau_led.c
@@ -107,7 +107,8 @@ nouveau_led_suspend(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
 
-	led_classdev_suspend(&drm->led->led);
+	if (drm->led)
+		led_classdev_suspend(&drm->led->led);
 }
 
 void
@@ -115,8 +116,8 @@ nouveau_led_resume(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
 
-	led_classdev_resume(&drm->led->led);
-
+	if (drm->led)
+		led_classdev_resume(&drm->led->led);
 }
 
 void
-- 
2.8.0



More information about the Nouveau mailing list