mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: fix Coverity issues
- operands not affecting result (id = 12845) - logically dead code (id = 12890) - dereference after null check (id = 12968) - unsigned compared to 0 (id = 13176) - resource leak (id = 13338, 18673) - unused pointer value (id = 13916) Bug 1703084 Change-Id: I2f401dd93126af27748c53fa1b3a59cb154af36b Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/835143 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
committed by
Sachin Nikam
parent
836027806d
commit
10f6da09eb
@@ -1688,17 +1688,14 @@ static int gk20a_channel_add_job(struct channel_gk20a *c,
|
|||||||
if (!skip_buffer_refcounting) {
|
if (!skip_buffer_refcounting) {
|
||||||
err = gk20a_vm_get_buffers(vm, &mapped_buffers,
|
err = gk20a_vm_get_buffers(vm, &mapped_buffers,
|
||||||
&num_mapped_buffers);
|
&num_mapped_buffers);
|
||||||
if (err) {
|
if (err)
|
||||||
gk20a_vm_put(vm);
|
goto err_put_vm;
|
||||||
return err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
job = kzalloc(sizeof(*job), GFP_KERNEL);
|
job = kzalloc(sizeof(*job), GFP_KERNEL);
|
||||||
if (!job) {
|
if (!job) {
|
||||||
gk20a_vm_put_buffers(vm, mapped_buffers, num_mapped_buffers);
|
err = -ENOMEM;
|
||||||
gk20a_vm_put(vm);
|
goto err_put_buffers;
|
||||||
return -ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put() is done in gk20a_channel_update() when the job is done */
|
/* put() is done in gk20a_channel_update() when the job is done */
|
||||||
@@ -1718,10 +1715,20 @@ static int gk20a_channel_add_job(struct channel_gk20a *c,
|
|||||||
list_add_tail(&job->list, &c->jobs);
|
list_add_tail(&job->list, &c->jobs);
|
||||||
mutex_unlock(&c->jobs_lock);
|
mutex_unlock(&c->jobs_lock);
|
||||||
} else {
|
} else {
|
||||||
return -ETIMEDOUT;
|
err = -ETIMEDOUT;
|
||||||
|
goto err_free_job;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_free_job:
|
||||||
|
kfree(job);
|
||||||
|
err_put_buffers:
|
||||||
|
gk20a_vm_put_buffers(vm, mapped_buffers, num_mapped_buffers);
|
||||||
|
err_put_vm:
|
||||||
|
gk20a_vm_put(vm);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gk20a_channel_update(struct channel_gk20a *c, int nr_completed)
|
void gk20a_channel_update(struct channel_gk20a *c, int nr_completed)
|
||||||
|
|||||||
@@ -1102,7 +1102,7 @@ static int gk20a_pm_enable_clk(struct device *dev)
|
|||||||
for (index = 0; index < platform->num_clks; index++) {
|
for (index = 0; index < platform->num_clks; index++) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
if (platform->clk[index])
|
if (platform->clk[index])
|
||||||
clk_prepare_enable(platform->clk[index]);
|
err = clk_prepare_enable(platform->clk[index]);
|
||||||
if (err)
|
if (err)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -1623,14 +1623,12 @@ static int gk20a_domain_init(struct of_device_id *matches)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
const struct of_device_id *match;
|
|
||||||
struct gk20a_domain_data *gk20a_domain;
|
struct gk20a_domain_data *gk20a_domain;
|
||||||
|
|
||||||
np = of_find_matching_node(NULL, matches);
|
np = of_find_matching_node(NULL, matches);
|
||||||
if (!np)
|
if (!np)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
match = of_match_node(matches, np);
|
|
||||||
gk20a_domain = (struct gk20a_domain_data *)kzalloc
|
gk20a_domain = (struct gk20a_domain_data *)kzalloc
|
||||||
(sizeof(struct gk20a_domain_data), GFP_KERNEL);
|
(sizeof(struct gk20a_domain_data), GFP_KERNEL);
|
||||||
if (!gk20a_domain)
|
if (!gk20a_domain)
|
||||||
|
|||||||
@@ -314,8 +314,7 @@ void gk20a_scale_init(struct platform_device *pdev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
err_get_freqs:
|
err_get_freqs:
|
||||||
kfree(g->scale_profile);
|
kfree(profile);
|
||||||
g->scale_profile = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gk20a_scale_exit(struct platform_device *pdev)
|
void gk20a_scale_exit(struct platform_device *pdev)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ static int gk20a_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op,
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
struct gr_gk20a *gr = &g->gr;
|
struct gr_gk20a *gr = &g->gr;
|
||||||
u32 fbp, slice, ctrl1, val, hw_op = 0;
|
u32 fbp, slice, ctrl1, val, hw_op = 0;
|
||||||
u32 retry = 200;
|
int retry = 200;
|
||||||
u32 slices_per_fbp =
|
u32 slices_per_fbp =
|
||||||
ltc_ltcs_ltss_cbc_param_slices_per_fbp_v(
|
ltc_ltcs_ltss_cbc_param_slices_per_fbp_v(
|
||||||
gk20a_readl(g, ltc_ltcs_ltss_cbc_param_r()));
|
gk20a_readl(g, ltc_ltcs_ltss_cbc_param_r()));
|
||||||
|
|||||||
@@ -1735,7 +1735,7 @@ int gk20a_vm_get_compbits_info(struct vm_gk20a *vm,
|
|||||||
|
|
||||||
mapped_buffer = find_mapped_buffer_locked(&vm->mapped_buffers, mapping_gva);
|
mapped_buffer = find_mapped_buffer_locked(&vm->mapped_buffers, mapping_gva);
|
||||||
|
|
||||||
if (!mapped_buffer | !mapped_buffer->user_mapped)
|
if (!mapped_buffer || !mapped_buffer->user_mapped)
|
||||||
{
|
{
|
||||||
mutex_unlock(&vm->update_gmmu_lock);
|
mutex_unlock(&vm->update_gmmu_lock);
|
||||||
gk20a_err(d, "%s: bad offset 0x%llx", __func__, mapping_gva);
|
gk20a_err(d, "%s: bad offset 0x%llx", __func__, mapping_gva);
|
||||||
|
|||||||
Reference in New Issue
Block a user