drm/amdgpu: WARN once if amdgpu_bo_unpin is called for an unpinned BO
authorMichel Dänzer <michel.daenzer@amd.com>
Thu, 13 Dec 2018 16:05:31 +0000 (17:05 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Dec 2018 20:55:17 +0000 (15:55 -0500)
It indicates a pin/unpin imbalance bug somewhere. While the bug isn't
necessarily in the call chain hitting this, it's at least one part
involved.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index fd271f9746a29ee6799f623557ffaf0354e31b45..728e15e5d68ac75c8f787896b13cb92a6be99977 100644 (file)
@@ -912,7 +912,7 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
        struct ttm_operation_ctx ctx = { false, false };
        int r, i;
 
-       if (!bo->pin_count) {
+       if (WARN_ON_ONCE(!bo->pin_count)) {
                dev_warn(adev->dev, "%p unpin not necessary\n", bo);
                return 0;
        }