[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190416015035.1435-3-itsbriany@gmail.com>
Date: Tue, 16 Apr 2019 01:50:35 +0000
From: Brian Yip <itsbriany@...il.com>
To: christian.koenig@....com
Cc: ray.huang@....com, Jerry.Zhang@....com, airlied@...ux.ie,
daniel@...ll.ch, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Brian Yip <itsbriany@...il.com>
Subject: [PATCH v2 2/2] drm/ttm: Reset ttm_bo_glob when initialized
Always initialize ttm_bo_glob from a pristine state when its use_count
is 0. Persist use_count so that ttm_bo_glob can later be released.
Signed-off-by: Brian Yip <itsbriany@...il.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 988416fb8a0b..d95762a90654 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1543,12 +1543,16 @@ static int ttm_bo_global_init(void)
{
struct ttm_bo_global *glob = &ttm_bo_glob;
int ret = 0;
- unsigned i;
+ unsigned i, uc;
mutex_lock(&ttm_global_mutex);
if (++glob->use_count > 1)
goto out;
+ uc = glob->use_count;
+ memset(glob, 0, sizeof(struct ttm_bo_global));
+ glob->use_count = uc;
+
ret = ttm_mem_global_init(&ttm_mem_glob);
if (ret)
goto out;
--
2.20.1
Powered by blists - more mailing lists