summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_prog.c
diff options
context:
space:
mode:
authorVijayakumar <vsubbu@nvidia.com>2017-01-05 05:50:51 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-05 13:38:45 -0500
commit4099785e2d60377459845b8fa886ab6be1a1d8e4 (patch)
tree600523620fcb2e80df04d1d684fcd7a1c8c8eb28 /drivers/gpu/nvgpu/clk/clk_prog.c
parent18a5111380343690148122434c8d3e1b9cfe48a5 (diff)
gpu: nvgpu: free boardobj if construct hits an err
During construct of some VFE/CLK boardobjs, some data is filled after a boardobj allocation is done. Free up boardobj memory if an error is encountered in the data filling. Coverity ID 490171 Coverity ID 490172 Bug 200192125 Change-Id: I20621f7f9f9e379b8dced4905cd417c2ffa905b0 Signed-off-by: Vijayakumar <vsubbu@nvidia.com> Reviewed-on: http://git-master/r/1280700 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_prog.c')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_prog.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_prog.c b/drivers/gpu/nvgpu/clk/clk_prog.c
index 6b81650e..22add3b0 100644
--- a/drivers/gpu/nvgpu/clk/clk_prog.c
+++ b/drivers/gpu/nvgpu/clk/clk_prog.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -703,14 +703,22 @@ static u32 clk_prog_construct_1x_master_table(struct gk20a *g,
703 pclkprog->p_slave_entries = 703 pclkprog->p_slave_entries =
704 (struct ctrl_clk_clk_prog_1x_master_table_slave_entry *) 704 (struct ctrl_clk_clk_prog_1x_master_table_slave_entry *)
705 kzalloc(slavesize, GFP_KERNEL); 705 kzalloc(slavesize, GFP_KERNEL);
706 if (!pclkprog->p_slave_entries) 706
707 return -ENOMEM; 707 if (!pclkprog->p_slave_entries) {
708 status = -ENOMEM;
709 goto exit;
710 }
708 711
709 memset(pclkprog->p_slave_entries, CTRL_CLK_CLK_DOMAIN_INDEX_INVALID, 712 memset(pclkprog->p_slave_entries, CTRL_CLK_CLK_DOMAIN_INDEX_INVALID,
710 slavesize); 713 slavesize);
711 714
712 memcpy(pclkprog->p_slave_entries, ptmpprog->p_slave_entries, slavesize); 715 memcpy(pclkprog->p_slave_entries, ptmpprog->p_slave_entries, slavesize);
713 716
717exit:
718 if (status) {
719 if (*ppboardobj != NULL)
720 (*ppboardobj)->destruct(*ppboardobj);
721 }
714 return status; 722 return status;
715} 723}
716 724