[PATCH] drm/amdgpu: fix uninitialized return value

ts8060 ts8060 at my.bristol.ac.uk
Tue May 11 17:25:16 UTC 2021


The amdgpu_display_suspend_helper() function uses an uninitialized
variable as its return value, causing a failure to suspend/resume on a
Radeon R7 240/340 GPU, with the following error in dmesg:
[drm:amdgpu_device_ip_suspend_phase1 [amdgpu]] *ERROR* suspend of IP block <dce_v6_0> failed 118489088

Initialize the variable to 0.

Signed-off-by: Tim Saunders <ts8060 at my.bristol.ac.uk>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 8a1fb8b6606e..27626d8a0647 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -1544,7 +1544,7 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
        struct drm_crtc *crtc;
        struct drm_connector *connector;
        struct drm_connector_list_iter iter;
-       int r;
+       int r = 0;

        /* turn off display hw */
        drm_modeset_lock_all(dev);
--
2.31.1


More information about the amd-gfx mailing list