summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/vgpu.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-02-13 14:22:59 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-20 19:39:55 -0400
commit74fe1caa2b56aab24c17ad4dd2524128fc237894 (patch)
tree0793bb92b67d64690658f3f7cd1a8e1ea93206ba /drivers/gpu/nvgpu/vgpu/vgpu.c
parent469308becaff326da02fcf791e803e812e1cf9f8 (diff)
gpu: nvgpu: Add refcounting to driver fds
The main driver structure is not refcounted properly, so when the driver unload, file desciptors associated to the driver are kept open with dangling references to the main object. This change adds referencing to the gk20a structure. bug 200277762 JIRA: EVLR-1023 Change-Id: Id892e9e1677a344789e99bf649088c076f0bf8de Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: http://git-master/r/1317420 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index d5eb05ac..a97c179f 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -638,6 +638,8 @@ int vgpu_probe(struct platform_device *pdev)
638 vgpu_create_sysfs(dev); 638 vgpu_create_sysfs(dev);
639 gk20a_init_gr(gk20a); 639 gk20a_init_gr(gk20a);
640 640
641 kref_init(&gk20a->refcount);
642
641 return 0; 643 return 0;
642} 644}
643 645
@@ -656,6 +658,7 @@ int vgpu_remove(struct platform_device *pdev)
656 gk20a_user_deinit(dev, &nvgpu_class); 658 gk20a_user_deinit(dev, &nvgpu_class);
657 vgpu_remove_sysfs(dev); 659 vgpu_remove_sysfs(dev);
658 gk20a_get_platform(dev)->g = NULL; 660 gk20a_get_platform(dev)->g = NULL;
659 kfree(g); 661 gk20a_put(g);
662
660 return 0; 663 return 0;
661} 664}