diff --git a/drivers/gpu/nvgpu/clk/clk_prog.c b/drivers/gpu/nvgpu/clk/clk_prog.c index 6b81650e6..22add3b0c 100644 --- a/drivers/gpu/nvgpu/clk/clk_prog.c +++ b/drivers/gpu/nvgpu/clk/clk_prog.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * 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, pclkprog->p_slave_entries = (struct ctrl_clk_clk_prog_1x_master_table_slave_entry *) kzalloc(slavesize, GFP_KERNEL); - if (!pclkprog->p_slave_entries) - return -ENOMEM; + + if (!pclkprog->p_slave_entries) { + status = -ENOMEM; + goto exit; + } memset(pclkprog->p_slave_entries, CTRL_CLK_CLK_DOMAIN_INDEX_INVALID, slavesize); memcpy(pclkprog->p_slave_entries, ptmpprog->p_slave_entries, slavesize); +exit: + if (status) { + if (*ppboardobj != NULL) + (*ppboardobj)->destruct(*ppboardobj); + } return status; } diff --git a/drivers/gpu/nvgpu/perf/vfe_var.c b/drivers/gpu/nvgpu/perf/vfe_var.c index f4c3f2764..f43e68e27 100644 --- a/drivers/gpu/nvgpu/perf/vfe_var.c +++ b/drivers/gpu/nvgpu/perf/vfe_var.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -668,12 +668,19 @@ static u32 vfe_var_construct_single_sensed_fuse(struct gk20a *g, if (pvfevar->vfield_info.fuse.segment_count == 0) { gk20a_err(dev_from_gk20a(g), "unable to get fuse reg info %x", pvfevar->vfield_info.v_field_id); - return -EINVAL; + status = -EINVAL; + goto exit; } if (pvfevar->vfield_ver_info.fuse.segment_count == 0) { gk20a_err(dev_from_gk20a(g), "unable to get fuse reg info %x", pvfevar->vfield_ver_info.v_field_id_ver); - return -EINVAL; + status = -EINVAL; + goto exit; + } +exit: + if (status) { + if (*ppboardobj != NULL) + (*ppboardobj)->destruct(*ppboardobj); } return status; }