Skip to contentSkip to conversation

drm/nouveau: fix pm initialization order

PATCH In review Dmitry Eremin-Solenikov 2 participants 2 messages Sep 25, 2012 – Sep 26, 2012 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/nouveau: fix pm initialization order

If nouveau_pm_perflvl_get() fails, pm->profiles list will be left uninitialized, which causes oops during nouveau_pm_fini().

Move INIT_LIST_HEAD before call to nouveau_pm_perflvl_get().

---
 drivers/gpu/drm/nouveau/nouveau_pm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_pm.c +2 -1
index 3c55ec2..d2f2de6 100644
@@ -916,6 +916,8 @@ nouveau_pm_init(struct drm_device *dev)
 	nouveau_volt_init(dev);
 	nouveau_temp_init(dev);
 
+	INIT_LIST_HEAD(&pm->profiles);
+
 	/* determine current ("boot") performance level */
 	ret = nouveau_pm_perflvl_get(dev, &pm->boot);
 	if (ret) {
@@ -927,7 +929,6 @@ nouveau_pm_init(struct drm_device *dev)
 	strncpy(pm->boot.profile.name, "boot", 4);
 	pm->boot.profile.func = &nouveau_pm_static_profile_func;
 
-	INIT_LIST_HEAD(&pm->profiles);
 	list_add(&pm->boot.profile.head, &pm->profiles);
 
 	pm->profile_ac = &pm->boot.profile;
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1348554700-7137-1-git-send-email-dmitry_eremin-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org

#2 lore raw
Quoted 4 lines · Dmitry Eremin-Solenikov

If nouveau_pm_perflvl_get() fails, pm->profiles list will be left uninitialized, which causes oops during nouveau_pm_fini().

Move INIT_LIST_HEAD before call to nouveau_pm_perflvl_get().

Pushed, thanks!

Quoted 34 lines
---
 drivers/gpu/drm/nouveau/nouveau_pm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_pm.c +2 -1
index 3c55ec2..d2f2de6 100644
@@ -916,6 +916,8 @@ nouveau_pm_init(struct drm_device *dev)
 	nouveau_volt_init(dev);
 	nouveau_temp_init(dev);
 
+	INIT_LIST_HEAD(&pm->profiles);
+
 	/* determine current ("boot") performance level */
 	ret = nouveau_pm_perflvl_get(dev, &pm->boot);
 	if (ret) {
@@ -927,7 +929,6 @@ nouveau_pm_init(struct drm_device *dev)
 	strncpy(pm->boot.profile.name, "boot", 4);
 	pm->boot.profile.func = &nouveau_pm_static_profile_func;
 
-	INIT_LIST_HEAD(&pm->profiles);
 	list_add(&pm->boot.profile.head, &pm->profiles);
 
 	pm->profile_ac = &pm->boot.profile;
Signature · 6 lines
1.7.10.4

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau