summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Kumbhar <nkumbhar@nvidia.com>2018-05-25 06:55:20 -0400
committerTejal Kudav <tkudav@nvidia.com>2018-06-14 09:44:06 -0400
commit2318e66a59e4e25240513fe7d267fc63b7353a15 (patch)
tree719b58c12a9ad7e2efa0e63628924c1e92acc12a
parentf9da1781f67b1c67f4c0825dae38dfc13e72bbc1 (diff)
gpu: nvgpu: gr: remove only created sysfs nodes
Sysfs nodes for GR stats are created on GR init. If nvgpu module is removed without any ops, then it tries to remove sysfs nodes which do not exist resulting in kernel panic. Fix this issue by removing sysfs nodes only if ecc counters are initialized. Bug 1987855 Change-Id: I3f967ee92ec02ad19ffbd9bfa8bace5bfd229dd2 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1730536 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
index b2d6230d..5d7ee84d 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
@@ -796,6 +796,9 @@ static void gr_gp10b_remove_sysfs(struct device *dev)
796{ 796{
797 struct gk20a *g = get_gk20a(dev); 797 struct gk20a *g = get_gk20a(dev);
798 798
799 if (!g->ecc.gr.sm_lrf_single_err_count.counters)
800 return;
801
799 gr_gp10b_ecc_stat_remove(dev, 802 gr_gp10b_ecc_stat_remove(dev,
800 0, 803 0,
801 &g->ecc.gr.sm_lrf_single_err_count, 804 &g->ecc.gr.sm_lrf_single_err_count,
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
index 9f9d5ee1..df760478 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
@@ -502,6 +502,9 @@ static void gr_gv11b_remove_sysfs(struct device *dev)
502{ 502{
503 struct gk20a *g = get_gk20a(dev); 503 struct gk20a *g = get_gk20a(dev);
504 504
505 if (!g->ecc.gr.sm_l1_tag_corrected_err_count.counters)
506 return;
507
505 gr_gp10b_ecc_stat_remove(dev, 508 gr_gp10b_ecc_stat_remove(dev,
506 0, 509 0,
507 &g->ecc.gr.sm_l1_tag_corrected_err_count, 510 &g->ecc.gr.sm_l1_tag_corrected_err_count,