summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2021-03-19 03:21:33 +0300
committerDave Airlie <airlied@redhat.com>2021-03-19 03:21:48 +0300
commitdb3f0d8ee9bf4b9fb7f9c8bbea3e5fad0cd9b66e (patch)
treef00a9dae3ebd557e891f695bf985f452c34d1fb4 /include
parent1e28eed17697bcf343c6743f0028cc3b5dd88bf0 (diff)
parent6909115442759efef3d4bc5d9c54d7943f1afc14 (diff)
downloadlinux-db3f0d8ee9bf4b9fb7f9c8bbea3e5fad0cd9b66e.tar.xz
Merge tag 'drm-misc-fixes-2021-03-18' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
drm-misc-fixes for v5.12-rc4: - Make ttm_bo_unpin() not wraparound on too many unpins. - Fix coccicheck warning in omap. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/a0e13bbb-6ba6-ff24-4db8-0e02e605de18@linux.intel.com
Diffstat (limited to 'include')
-rw-r--r--include/drm/ttm/ttm_bo_api.h6
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 e17be324d95f..b8ca13664fa2 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -612,9 +612,11 @@ 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);
WARN_ON_ONCE(!kref_read(&bo->kref));
- --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,