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
This commit is contained in:
Terje Bergstrom
2017-01-19 15:32:50 -08:00
committed by mobile promotions
parent 6343e96f37
commit 29400cbbae

View File

@@ -751,8 +751,11 @@ static struct clk_prog *construct_clk_prog(struct gk20a *g, void *pargs)
return NULL;
}
if (status)
if (status) {
if (board_obj_ptr)
board_obj_ptr->destruct(board_obj_ptr);
return NULL;
}
gk20a_dbg_info(" Done");