gpu: nvgpu: fix nvgpu_remove on nvlink failure

In case nvlink initialization failure, some structures are not
yet initialized, and attempting to de-initialize them caused some
memory faults.
Added checks before de-initializing fecs_traces, and perf_pmu and
clk_pmu.

Bug 200542335

Change-Id: Ib40820b6b5bf356f762112b772a9df533b36b045
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2176206
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Thomas Fleury
2019-08-15 16:40:53 -04:00
committed by mobile promotions
parent 3845316f1a
commit 3bc6ea5fbd
2 changed files with 19 additions and 9 deletions

View File

@@ -163,6 +163,10 @@ int nvgpu_gr_fecs_trace_deinit(struct gk20a *g)
{
struct nvgpu_gr_fecs_trace *trace = g->fecs_trace;
if (trace == NULL) {
return 0;
}
/*
* Check if tracer was enabled before attempting to stop the
* tracer thread.

View File

@@ -48,7 +48,12 @@ void nvgpu_pmu_pstate_deinit(struct gk20a *g)
{
pmgr_pmu_free_pmupstate(g);
nvgpu_therm_pmu_free_pmupstate(g, g->pmu);
if (g->perf_pmu != NULL) {
nvgpu_perf_pmu_free_pmupstate(g);
}
if (g->pmu->clk_pmu != NULL) {
nvgpu_clk_domain_free_pmupstate(g);
nvgpu_clk_prog_free_pmupstate(g);
nvgpu_clk_vf_point_free_pmupstate(g);
@@ -57,6 +62,7 @@ void nvgpu_pmu_pstate_deinit(struct gk20a *g)
nvgpu_clk_fll_free_pmupstate(g);
nvgpu_clk_vin_free_pmupstate(g);
nvgpu_clk_free_pmupstate(g);
}
if (g->ops.clk.mclk_deinit != NULL) {
g->ops.clk.mclk_deinit(g);