Message ID | 20190416015035.1435-3-itsbriany@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/ttm: Cleanup state in global ttm structures | expand |
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;
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(-)