From 918b4c2c76db79521e39adf0f1a4cdb36bc39aae Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 28 Aug 2023 16:22:40 +0000 Subject: [PATCH] Revert "drm/ttm: make ttm_bo_unpin more defensive" This reverts commit 4148f28f9824c00f81e41e729ee0a001d274a566 which is commit 6c5403173a13a08ff61dbdafa4c0ed4a9dedbfe0 upstream. It breaks the Android kernel abi, and is not needed for any Android devices at this time. If it is needed in the future, it can be brought back in an abi-safe way. Bug: 161946584 Change-Id: I583e85294adb0b0110b0da28b830001a002cc946 Signed-off-by: Greg Kroah-Hartman --- include/drm/ttm/ttm_bo_api.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 09ccfee48fb4..33aca60870e2 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -628,10 +628,8 @@ static inline void ttm_bo_pin(struct ttm_buffer_object *bo) static inline void ttm_bo_unpin(struct ttm_buffer_object *bo) { dma_resv_assert_held(bo->base.resv); - if (bo->pin_count) - --bo->pin_count; - else - WARN_ON_ONCE(true); + WARN_ON_ONCE(!bo->pin_count); + --bo->pin_count; } int ttm_mem_evict_first(struct ttm_bo_device *bdev,