Skip to content

Commit 5fa9937

Browse files
ZhenGuo Yinalexdeucher
authored andcommitted
drm/amd/pm: Init pm_attr_list when dpm is disabled
[Why] In SRIOV multi-vf, dpm is always disabled, and pm_attr_list won't be initialized. There will be a NULL pointer call trace after removing the dpm check condition in amdgpu_pm_sysfs_fini. BUG: kernel NULL pointer dereference, address: 0000000000000000 RIP: 0010:amdgpu_device_attr_remove_groups+0x20/0x90 [amdgpu] Call Trace: <TASK> amdgpu_pm_sysfs_fini+0x2f/0x40 [amdgpu] amdgpu_device_fini_hw+0xdf/0x290 [amdgpu] [How] List pm_attr_list should be initialized when dpm is disabled. Fixes: a6ad27c ("drm/amd/pm: Remove redundant check condition") Signed-off-by: ZhenGuo Yin <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3059cd8 commit 5fa9937

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/amd/pm/amdgpu_pm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,11 +3362,11 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
33623362
if (adev->pm.sysfs_initialized)
33633363
return 0;
33643364

3365+
INIT_LIST_HEAD(&adev->pm.pm_attr_list);
3366+
33653367
if (adev->pm.dpm_enabled == 0)
33663368
return 0;
33673369

3368-
INIT_LIST_HEAD(&adev->pm.pm_attr_list);
3369-
33703370
adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev,
33713371
DRIVER_NAME, adev,
33723372
hwmon_groups);

0 commit comments

Comments
 (0)