Skip to content

Commit

Permalink
drm/nouveau: fix pm initialization order
Browse files Browse the repository at this point in the history
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: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Dmitry Eremin-Solenikov authored and Ben Skeggs committed Oct 3, 2012
1 parent acac7bd commit d89c8ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/nouveau/nouveau_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit d89c8ce

Please sign in to comment.