If a queue fails to map that we need to return the error code back
to the caller and not overwrite with a success specifically.

Accumulate the failure and return that.

Signed-off-by: Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index f16af852725a..9dc937c22b05 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -1562,7 +1562,7 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, 
bool vram_lost)
        struct amdgpu_usermode_queue *queue;
        const struct amdgpu_userq_funcs *userq_funcs;
        unsigned long queue_id;
-       int r = 0;
+       int ret = 0, r;
 
        xa_for_each(&adev->userq_doorbell_xa, queue_id, queue) {
                if (queue->state == AMDGPU_USERQ_STATE_HUNG && !vram_lost) {
@@ -1573,6 +1573,7 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, 
bool vram_lost)
                        r = userq_funcs->map(queue);
                        if (r) {
                                dev_err(adev->dev, "Failed to remap queue 
%ld\n", queue_id);
+                               ret = r;
                                continue;
                        }
                        trace_amdgpu_userq_state_changed(queue, 
AMDGPU_USERQ_STATE_MAPPED);
@@ -1580,5 +1581,5 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, 
bool vram_lost)
                }
        }
 
-       return r;
+       return ret;
 }
-- 
2.34.1

Reply via email to