gpu: nvgpu: Free arb substructures only if arb allocated

nvgpu_clk_arb_init_arbiter() allocates master structure arb, and
sub-structures which is assigns as members of arb. At failure,
there's a single error label, and it tries to free the members of
arb without checking that arb was allocated.

Change-Id: Ifac7552b05dad17036835eb3ee624eae351ccb7d
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1279226
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
This commit is contained in:
Terje Bergstrom
2016-12-20 15:53:26 -08:00
committed by mobile promotions
parent 685b4d351e
commit 7feff293e4

View File

@@ -296,12 +296,14 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g)
init_fail:
kfree(arb->gpc2clk_f_points);
kfree(arb->mclk_f_points);
if (arb) {
kfree(arb->gpc2clk_f_points);
kfree(arb->mclk_f_points);
for (index = 0; index < 2; index++) {
kfree(arb->vf_table_pool[index].gpc2clk_points);
kfree(arb->vf_table_pool[index].mclk_points);
for (index = 0; index < 2; index++) {
kfree(arb->vf_table_pool[index].gpc2clk_points);
kfree(arb->vf_table_pool[index].mclk_points);
}
}
kfree(arb);