From fb7c8c756c9aa207d76d8316c3482a306b36596a Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 27 Apr 2016 14:57:37 +0530 Subject: gpu: nvgpu: fix resource leaks with gr_gk20a_elpg_protected_call In gr_gk20a_elpg_protected_call(), we return with error value if we fail to disable elpg But since this is a #define'd function, we end up returning from function which is using gr_gk20a_elpg_protected_call() So in some cases it is possible that parent function does not free up resources due to return statement in gr_gk20a_elpg_protected_call() Fix this by removing return statement, and execute rest of the code if there is no error Coverity id : 31980 Bug 200192125 Change-Id: Ic003b160b76820cdf9355f44658c23bfb2f3815f Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1133404 GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gr_gk20a.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h index 3702c82d..681a0437 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h @@ -475,14 +475,14 @@ void gk20a_gr_clear_sm_hww(struct gk20a *g, int err = 0; \ if (support_gk20a_pmu(g->dev) && g->elpg_enabled) {\ err = gk20a_pmu_disable_elpg(g); \ - if (err) { \ + if (err) \ + gk20a_pmu_enable_elpg(g); \ + } \ + if (!err) { \ + err = func; \ + if (support_gk20a_pmu(g->dev) && g->elpg_enabled) \ gk20a_pmu_enable_elpg(g); \ - return err; \ - } \ } \ - err = func; \ - if (support_gk20a_pmu(g->dev) && g->elpg_enabled) \ - gk20a_pmu_enable_elpg(g); \ err; \ }) -- cgit v1.2.2