diff options
| author | Mario Limonciello <[email protected]> | 2023-09-21 09:50:04 -0500 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2023-09-26 17:00:22 -0400 |
| commit | 7441ef0b3ebe11ee46db82f7f7eee0f68b35e192 (patch) | |
| tree | 947fe9e7524e82c053dce6757f3938b0e6680614 /drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |
| parent | 41801c6b3042e2813365ee4def3f2804fd77776a (diff) | |
drm/amd: Propagate failures in dc_set_power_state()
During the suspend process dc_set_power_state() will use kzalloc
to allocate memory, but this potentially fails with memory pressure.
If it fails, the suspend should be aborted.
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2362
Signed-off-by: Mario Limonciello <[email protected]>
Reviewed-by: Christian König <[email protected]>
Cc: [email protected]
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index a0023d157ffb..3480a02af797 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2671,9 +2671,7 @@ static int dm_suspend(void *handle) hpd_rx_irq_work_suspend(dm); - dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3); - - return 0; + return dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3); } struct amdgpu_dm_connector * @@ -2867,7 +2865,10 @@ static int dm_resume(void *handle) if (r) DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r); - dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0); + r = dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0); + if (r) + return r; + dc_resume(dm->dc); amdgpu_dm_irq_resume_early(adev); @@ -2916,7 +2917,9 @@ static int dm_resume(void *handle) } /* power on hardware */ - dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0); + r = dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0); + if (r) + return r; /* program HPD filter */ dc_resume(dm->dc); |