drm/amdgpu: Real return value can be over-written when clean up
authorAlex Xie <AlexBin.Xie@amd.com>
Mon, 24 Apr 2017 19:26:57 +0000 (15:26 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 28 Apr 2017 21:33:07 +0000 (17:33 -0400)
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c

index cc97eee9322640bf5c881aef67d0e8cbb0efc2d5..726b3e018eebe9396a69201a20b85d9233b8865b 100644 (file)
@@ -117,6 +117,11 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
        }
 
 out_cleanup:
+       /* Check error value now. The value can be overwritten when clean up.*/
+       if (r) {
+               DRM_ERROR("Error while benchmarking BO move.\n");
+       }
+
        if (sobj) {
                r = amdgpu_bo_reserve(sobj, false);
                if (likely(r == 0)) {
@@ -133,10 +138,6 @@ out_cleanup:
                }
                amdgpu_bo_unref(&dobj);
        }
-
-       if (r) {
-               DRM_ERROR("Error while benchmarking BO move.\n");
-       }
 }
 
 void amdgpu_benchmark(struct amdgpu_device *adev, int test_number)