From 71c8d998d4c5a33dea9a19548af71faa6a20fca7 Mon Sep 17 00:00:00 2001 From: Shashank Singh Date: Tue, 21 Jul 2020 08:55:04 +0000 Subject: [PATCH] gpu: nvgpu: return error if therm is uninitialized If therm is not initialized then return error for getting temperature API. Bug 200638833 Jira NVGPU-5832 Change-Id: Iebe44218d76d39d5bf765e8de6fd74c3b64c8b68 Signed-off-by: Shashank Singh Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2382905 Reviewed-by: Dinesh T Reviewed-by: automaticguardword Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Ramesh Mylavarapu Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/therm/therm_channel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/nvgpu/common/pmu/therm/therm_channel.c b/drivers/gpu/nvgpu/common/pmu/therm/therm_channel.c index 3aad7f729..d959a0015 100644 --- a/drivers/gpu/nvgpu/common/pmu/therm/therm_channel.c +++ b/drivers/gpu/nvgpu/common/pmu/therm/therm_channel.c @@ -337,6 +337,10 @@ static int therm_channel_boardobj_grp_get_status(struct gk20a *g) nvgpu_log_info(g, " "); + if (g->pmu->therm_pmu == NULL) { + return -EINVAL; + } + pboardobjgrp = &g->pmu->therm_pmu->therm_channelobjs.super.super; pboardobjgrpmask = &g->pmu->therm_pmu->therm_channelobjs.super.mask.super; status = pboardobjgrp->pmugetstatus(g, pboardobjgrp, pboardobjgrpmask);