mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 09:57:08 +03:00
gpu: nvgpu: check return value of mutex_init in clk_arb.c
- check return value of nvgpu_mutex_init in clk_arb.c - add corresponding nvgpu_mutex_destroy calls Jira NVGPU-13 Change-Id: I823888ec234ce5358187c449de8e6cabc5fc5503 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1317133 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Navneet Kumar <navneetk@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
de568db9de
commit
d6150fa12c
@@ -267,10 +267,14 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
arb = kzalloc(sizeof(struct nvgpu_clk_arb), GFP_KERNEL);
|
arb = kzalloc(sizeof(struct nvgpu_clk_arb), GFP_KERNEL);
|
||||||
if (!arb) {
|
if (!arb)
|
||||||
err = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto init_fail;
|
|
||||||
}
|
err = nvgpu_mutex_init(&arb->pstate_lock);
|
||||||
|
if (err)
|
||||||
|
goto mutex_fail;
|
||||||
|
nvgpu_spinlock_init(&arb->sessions_lock);
|
||||||
|
nvgpu_spinlock_init(&arb->users_lock);
|
||||||
|
|
||||||
arb->mclk_f_points = kcalloc(MAX_F_POINTS, sizeof(u16), GFP_KERNEL);
|
arb->mclk_f_points = kcalloc(MAX_F_POINTS, sizeof(u16), GFP_KERNEL);
|
||||||
if (!arb->mclk_f_points) {
|
if (!arb->mclk_f_points) {
|
||||||
@@ -308,10 +312,6 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g)
|
|||||||
g->clk_arb = arb;
|
g->clk_arb = arb;
|
||||||
arb->g = g;
|
arb->g = g;
|
||||||
|
|
||||||
nvgpu_mutex_init(&arb->pstate_lock);
|
|
||||||
nvgpu_spinlock_init(&arb->sessions_lock);
|
|
||||||
nvgpu_spinlock_init(&arb->users_lock);
|
|
||||||
|
|
||||||
err = g->ops.clk_arb.get_arbiter_clk_default(g,
|
err = g->ops.clk_arb.get_arbiter_clk_default(g,
|
||||||
CTRL_CLK_DOMAIN_MCLK, &default_mhz);
|
CTRL_CLK_DOMAIN_MCLK, &default_mhz);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
@@ -382,16 +382,17 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g)
|
|||||||
|
|
||||||
init_fail:
|
init_fail:
|
||||||
|
|
||||||
if (arb) {
|
kfree(arb->gpc2clk_f_points);
|
||||||
kfree(arb->gpc2clk_f_points);
|
kfree(arb->mclk_f_points);
|
||||||
kfree(arb->mclk_f_points);
|
|
||||||
|
|
||||||
for (index = 0; index < 2; index++) {
|
for (index = 0; index < 2; index++) {
|
||||||
kfree(arb->vf_table_pool[index].gpc2clk_points);
|
kfree(arb->vf_table_pool[index].gpc2clk_points);
|
||||||
kfree(arb->vf_table_pool[index].mclk_points);
|
kfree(arb->vf_table_pool[index].mclk_points);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvgpu_mutex_destroy(&arb->pstate_lock);
|
||||||
|
|
||||||
|
mutex_fail:
|
||||||
kfree(arb);
|
kfree(arb);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@@ -454,6 +455,7 @@ static void nvgpu_clk_arb_set_global_alarm(struct gk20a *g, u32 alarm)
|
|||||||
|
|
||||||
void nvgpu_clk_arb_cleanup_arbiter(struct gk20a *g)
|
void nvgpu_clk_arb_cleanup_arbiter(struct gk20a *g)
|
||||||
{
|
{
|
||||||
|
nvgpu_mutex_destroy(&g->clk_arb->pstate_lock);
|
||||||
kfree(g->clk_arb);
|
kfree(g->clk_arb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user