diff options
author | Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com> | 2012-09-25 02:31:40 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-02 23:13:12 -0400 |
commit | d89c8ce07168ef6cd16c71d0a9f618829e866e87 (patch) | |
tree | 418e10f2489d4222f2326e8f20cfeca14d1ec9cb | |
parent | acac7bdba61226502a230db9245ca426a67102a9 (diff) |
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: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_pm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 3c55ec2366d3..d2f2de67f688 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -916,6 +916,8 @@ nouveau_pm_init(struct drm_device *dev) | |||
916 | nouveau_volt_init(dev); | 916 | nouveau_volt_init(dev); |
917 | nouveau_temp_init(dev); | 917 | nouveau_temp_init(dev); |
918 | 918 | ||
919 | INIT_LIST_HEAD(&pm->profiles); | ||
920 | |||
919 | /* determine current ("boot") performance level */ | 921 | /* determine current ("boot") performance level */ |
920 | ret = nouveau_pm_perflvl_get(dev, &pm->boot); | 922 | ret = nouveau_pm_perflvl_get(dev, &pm->boot); |
921 | if (ret) { | 923 | if (ret) { |
@@ -927,7 +929,6 @@ nouveau_pm_init(struct drm_device *dev) | |||
927 | strncpy(pm->boot.profile.name, "boot", 4); | 929 | strncpy(pm->boot.profile.name, "boot", 4); |
928 | pm->boot.profile.func = &nouveau_pm_static_profile_func; | 930 | pm->boot.profile.func = &nouveau_pm_static_profile_func; |
929 | 931 | ||
930 | INIT_LIST_HEAD(&pm->profiles); | ||
931 | list_add(&pm->boot.profile.head, &pm->profiles); | 932 | list_add(&pm->boot.profile.head, &pm->profiles); |
932 | 933 | ||
933 | pm->profile_ac = &pm->boot.profile; | 934 | pm->profile_ac = &pm->boot.profile; |