diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-01-19 18:32:50 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-26 13:53:06 -0500 |
commit | 29400cbbae01472ddb103fe6bd8a3a8619f63f80 (patch) | |
tree | f22c48c62f013e4fa1587c4d3851e83435704906 /drivers/gpu/nvgpu/clk/clk_prog.c | |
parent | 6343e96f3752ed2a9e3c34b1106abb4bc6d7a3d2 (diff) |
gpu: nvgpu: Free board_obj_ptr in case of error
If construct_clk_prog() gets an error reported in status, it returns
NULL instead of the constructed board_obj_ptr.
Call a destructor to prevent leaking any possibly constructed
board_obj_ptr.
Coverity ID 490171
Change-Id: Icf359da6511b108a03dd86d4556c5cbb288e90de
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1291682
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_prog.c')
-rw-r--r-- | drivers/gpu/nvgpu/clk/clk_prog.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_prog.c b/drivers/gpu/nvgpu/clk/clk_prog.c index d4876da8..b8c8d9a2 100644 --- a/drivers/gpu/nvgpu/clk/clk_prog.c +++ b/drivers/gpu/nvgpu/clk/clk_prog.c | |||
@@ -751,8 +751,11 @@ static struct clk_prog *construct_clk_prog(struct gk20a *g, void *pargs) | |||
751 | return NULL; | 751 | return NULL; |
752 | } | 752 | } |
753 | 753 | ||
754 | if (status) | 754 | if (status) { |
755 | if (board_obj_ptr) | ||
756 | board_obj_ptr->destruct(board_obj_ptr); | ||
755 | return NULL; | 757 | return NULL; |
758 | } | ||
756 | 759 | ||
757 | gk20a_dbg_info(" Done"); | 760 | gk20a_dbg_info(" Done"); |
758 | 761 | ||