lkml.org 
[lkml]   [2019]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 2/2] drm/ttm: Reset ttm_bo_glob when initialized
Date
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@gmail.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
\
 
 \ /
  Last update: 2019-04-16 03:52    [W:0.021 / U:11.140 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site