From 2318e66a59e4e25240513fe7d267fc63b7353a15 Mon Sep 17 00:00:00 2001 From: Nitin Kumbhar Date: Fri, 25 May 2018 16:25:20 +0530 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1730536 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c | 3 +++ drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c | 3 +++ 2 files changed, 6 insertions(+) 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) { struct gk20a *g = get_gk20a(dev); + if (!g->ecc.gr.sm_lrf_single_err_count.counters) + return; + gr_gp10b_ecc_stat_remove(dev, 0, &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) { struct gk20a *g = get_gk20a(dev); + if (!g->ecc.gr.sm_l1_tag_corrected_err_count.counters) + return; + gr_gp10b_ecc_stat_remove(dev, 0, &g->ecc.gr.sm_l1_tag_corrected_err_count, -- cgit v1.2.2