gpu: nvgpu: protect clk_arb init with mutex.

g->clk_arb is currently initialized as a part of gk20a_finalize_poweron().
Any subsequent call to gk20a_finalize_poweron reinitializes the clk_arb
and leading to memory leaks. This is resolved by protecting the
g->clk_arb initialization with a mutex clk_arb_enable_lock in struct
gk20a. We skip initializing the g->clk_arb if its not NULL.

Bug 2061372

Change-Id: I59158e0a5e4c827fdbd6d9ea2d04c78d0986347a
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1811650
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Debarshi Dutta
2018-09-03 10:51:02 +05:30
committed by mobile promotions
parent 16ad9f5379
commit bac38f52cc
5 changed files with 22 additions and 1 deletions

View File

@@ -1310,6 +1310,8 @@ int nvgpu_remove(struct device *dev, struct class *class)
if (platform->remove)
platform->remove(dev);
nvgpu_mutex_destroy(&g->clk_arb_enable_lock);
nvgpu_log_fn(g, "removed");
return err;