Commit d89c8ce0 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Ben Skeggs

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().
Signed-off-by: default avatarDmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent acac7bdb
...@@ -916,6 +916,8 @@ nouveau_pm_init(struct drm_device *dev) ...@@ -916,6 +916,8 @@ nouveau_pm_init(struct drm_device *dev)
nouveau_volt_init(dev); nouveau_volt_init(dev);
nouveau_temp_init(dev); nouveau_temp_init(dev);
INIT_LIST_HEAD(&pm->profiles);
/* determine current ("boot") performance level */ /* determine current ("boot") performance level */
ret = nouveau_pm_perflvl_get(dev, &pm->boot); ret = nouveau_pm_perflvl_get(dev, &pm->boot);
if (ret) { if (ret) {
...@@ -927,7 +929,6 @@ nouveau_pm_init(struct drm_device *dev) ...@@ -927,7 +929,6 @@ nouveau_pm_init(struct drm_device *dev)
strncpy(pm->boot.profile.name, "boot", 4); strncpy(pm->boot.profile.name, "boot", 4);
pm->boot.profile.func = &nouveau_pm_static_profile_func; pm->boot.profile.func = &nouveau_pm_static_profile_func;
INIT_LIST_HEAD(&pm->profiles);
list_add(&pm->boot.profile.head, &pm->profiles); list_add(&pm->boot.profile.head, &pm->profiles);
pm->profile_ac = &pm->boot.profile; pm->profile_ac = &pm->boot.profile;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment