diff options
| author | Christian König <christian.koenig@amd.com> | 2021-03-12 09:34:39 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-08-11 11:57:44 +0200 |
| commit | 4148f28f9824c00f81e41e729ee0a001d274a566 (patch) | |
| tree | b5f3246f3f70ea15698ef37f5c69fab22c7d9e8f /include/drm | |
| parent | c0f2b2b020961f1346c8f07e9de43e6cca48726a (diff) | |
| download | linux-4148f28f9824c00f81e41e729ee0a001d274a566.tar.gz linux-4148f28f9824c00f81e41e729ee0a001d274a566.tar.bz2 linux-4148f28f9824c00f81e41e729ee0a001d274a566.zip | |
drm/ttm: make ttm_bo_unpin more defensive
commit 6c5403173a13a08ff61dbdafa4c0ed4a9dedbfe0 upstream.
We seem to have some more driver bugs than thought.
Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: deb0814b43f3 ("drm/ttm: add ttm_bo_pin()/ttm_bo_unpin() v2")
Acked-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210312093810.2202-1-christian.koenig@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/drm')
| -rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 33aca60870e2..09ccfee48fb4 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -628,8 +628,10 @@ 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); - WARN_ON_ONCE(!bo->pin_count); - --bo->pin_count; + if (bo->pin_count) + --bo->pin_count; + else + WARN_ON_ONCE(true); } int ttm_mem_evict_first(struct ttm_bo_device *bdev, |
