From e3e80f8d261f9d8ed5324ecb3e6263beedad7228 Mon Sep 17 00:00:00 2001 From: Rajesh Devaraj Date: Mon, 6 Feb 2023 19:06:18 +0000 Subject: [PATCH] gpu: nvgpu: add check related to pmu_support This patch performs the dereferncing of PMU from GPU driver struct only when PMU is supported. JIRA NVGPU-9283 Change-Id: I9a589cd999ff726220168cf108c7e419a5f52038 Signed-off-by: Rajesh Devaraj Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2854013 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Mahantesh Kumbar Reviewed-by: svc-mobile-misra Reviewed-by: Seema Khowala GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/pmu/pg/pmu_pg.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/common/pmu/pg/pmu_pg.c b/drivers/gpu/nvgpu/common/pmu/pg/pmu_pg.c index 0d625125b..30658b872 100644 --- a/drivers/gpu/nvgpu/common/pmu/pg/pmu_pg.c +++ b/drivers/gpu/nvgpu/common/pmu/pg/pmu_pg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2023, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1209,9 +1209,15 @@ int nvgpu_pmu_pg_buf_alloc(struct gk20a *g, struct nvgpu_pmu *pmu, u32 size) int nvgpu_pmu_restore_golden_img_state(struct gk20a *g) { - struct nvgpu_pmu *pmu = g->pmu; + struct nvgpu_pmu *pmu; int err = 0; + if (!g->support_ls_pmu) { + return 0; + } + + pmu = g->pmu; + if (!is_pg_supported(g, pmu->pg)) { goto out; }