diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-11-02 18:41:37 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-06 13:06:40 -0500 |
commit | 1e7ba4c76d5a6a1b89f3af3bc418391596adc3f3 (patch) | |
tree | 49281effa663007dfb090233e088864d3520e975 /drivers/gpu/nvgpu/gk20a | |
parent | 9f5f029ae291ebbfef9f1e08b39875fa47c44982 (diff) |
gpu: nvgpu: Use a callback to free struct gk20a
struct gk20a is now part of nvgpu_os_linux in Linux builds. gk20a.c
still frees struct gk20a by kfree(struct gk20a *), which is wrong.
Create a new function pointer in struct gk20a for freeing the
structure and call kfree(struct nvgpu_os_linux *) instead.
JIRA NVGPU-259
Change-Id: I412ee993002cb2a42f0db015fc676de43418ec2f
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1591012
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index f71a51fd..e8db9d2c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -518,7 +518,8 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount) | |||
518 | if (g->remove_support) | 518 | if (g->remove_support) |
519 | g->remove_support(g); | 519 | g->remove_support(g); |
520 | 520 | ||
521 | kfree(g); | 521 | if (g->free) |
522 | g->free(g); | ||
522 | } | 523 | } |
523 | 524 | ||
524 | /** | 525 | /** |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 7e7d9688..5b22d1a4 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -1070,6 +1070,7 @@ struct nvgpu_gpu_params { | |||
1070 | }; | 1070 | }; |
1071 | 1071 | ||
1072 | struct gk20a { | 1072 | struct gk20a { |
1073 | void (*free)(struct gk20a *g); | ||
1073 | struct nvgpu_nvhost_dev *nvhost_dev; | 1074 | struct nvgpu_nvhost_dev *nvhost_dev; |
1074 | 1075 | ||
1075 | /* | 1076 | /* |