From 167e7b02566ada6572705828885a9849f497dba1 Mon Sep 17 00:00:00 2001 From: Jinesh Parakh Date: Thu, 14 Apr 2022 00:04:40 +0530 Subject: [PATCH] gpu: nvgpu: Fix Unused value Defect Fix following Coverity Defect: nvgpu_init.c : Unused value The ret variable was being reassigned the error code from nvgpu_cic_mon_deinit(g) without taking into account the previous ret value. We need to propagate whether there is an error (the last known error is returned) or not using ret, the temp_ret variable helps in verifying this. Similar coding style followed in the entire function. CID 10127863 Bug 3460991 Signed-off-by: Jinesh Parakh Change-Id: I732ba5269ebbbe68f113e53229df40ae49ccc13c Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2697104 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/common/init/nvgpu_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/common/init/nvgpu_init.c b/drivers/gpu/nvgpu/common/init/nvgpu_init.c index 55d2d55a9..cbb099d2a 100644 --- a/drivers/gpu/nvgpu/common/init/nvgpu_init.c +++ b/drivers/gpu/nvgpu/common/init/nvgpu_init.c @@ -394,8 +394,9 @@ int nvgpu_prepare_poweroff(struct gk20a *g) * This will ensure that CIC will not get probed * after it's deinit. */ - ret = nvgpu_cic_mon_deinit(g); - if (ret != 0) { + tmp_ret = nvgpu_cic_mon_deinit(g); + if (tmp_ret != 0) { + ret = tmp_ret; nvgpu_err(g, "Failed to deinit CIC-mon."); }