diff mbox

[4/7] drm/cirrus: add return 0 to make sure if (bo->pin_count) early_exit

Message ID 1438250938-59728-5-git-send-email-zhjwpku@gmail.com
State New, archived
Headers show

Commit Message

John Hunter July 30, 2015, 10:08 a.m. UTC
From: Zhao Junwang <zhjwpku@gmail.com>

when the first modeset calls prepare_fb, bo->pin_count change from
0 to 1, then the second modeset with the same fb, that should set
bo->pin_count to 2, and then when cleanup_fb was called, bo->pin_count
should be 2 to 1.

But in the cirrus_bo_pin, it will set bo->pin_count = 1 at the end
of the function, this results that bo->bin_count will never be larger
than 1 no matter how many times cirrus_bo_pin was called.

So we need to add a condition before bo->pin_count = 1

V2: if (bo->pin_count) early_exit; do_the_real_pinning work

Signed-off-by: Zhao Junwang <zhjwpku@gmail.com>
 drivers/gpu/drm/cirrus/cirrus_ttm.c |    2 ++
 1 file changed, 2 insertions(+)
diff mbox


diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index dfffd52..756b6d0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -364,6 +364,8 @@  int cirrus_bo_pin(struct cirrus_bo *bo, u32 pl_flag, u64 *gpu_addr)
 		if (gpu_addr)
 			*gpu_addr = cirrus_bo_gpu_offset(bo);
+		return 0;
 	cirrus_ttm_placement(bo, pl_flag);