summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-11-29 02:35:57 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-29 14:54:14 -0500
commitb6b71bd4a82d5a8734b9e703ea2468297fbe9645 (patch)
tree202f49ae43fee788faba7e81fca23e96a3f3db43 /drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
parent0be5d655604fb7f453a3ec00c8675d749555481d (diff)
gpu: nvgpu: fix cleanup path in css_gr_create_client_data()
In css_gr_create_client_data(), we call css_gr_free_client_data() in case cur->perfmon_start is zero css_gr_free_client_data() deletes the node from list, and performs some cleanup if cur->perfmon_start is non-zero Hence it is incorrect to call css_gr_free_client_data() in clean up path since node is not added to the list, and cur->perfmon_start is zero anyways Fix the cleanup path, and remove call to css_gr_free_client_data() Jira NVGPU-397 Change-Id: I9cb1abf4d6a02716156c9ea2d4a7963e1c92a531 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1606977 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
index afba2496..dcd5b074 100644
--- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
@@ -455,8 +455,6 @@ static int css_gr_create_client_data(struct gk20a *g,
455 u32 perfmon_count, 455 u32 perfmon_count,
456 struct gk20a_cs_snapshot_client *cur) 456 struct gk20a_cs_snapshot_client *cur)
457{ 457{
458 int ret = 0;
459
460 memset(cur->snapshot, 0, sizeof(*cur->snapshot)); 458 memset(cur->snapshot, 0, sizeof(*cur->snapshot));
461 cur->snapshot->start = sizeof(*cur->snapshot); 459 cur->snapshot->start = sizeof(*cur->snapshot);
462 /* we should be ensure that can fit all fifo entries here */ 460 /* we should be ensure that can fit all fifo entries here */
@@ -475,21 +473,13 @@ static int css_gr_create_client_data(struct gk20a *g,
475 if (cur->perfmon_count && g->ops.css.allocate_perfmon_ids) { 473 if (cur->perfmon_count && g->ops.css.allocate_perfmon_ids) {
476 cur->perfmon_start = g->ops.css.allocate_perfmon_ids(data, 474 cur->perfmon_start = g->ops.css.allocate_perfmon_ids(data,
477 cur->perfmon_count); 475 cur->perfmon_count);
478 if (!cur->perfmon_start) { 476 if (!cur->perfmon_start)
479 ret = -ENOENT; 477 return -ENOENT;
480 goto failed;
481 }
482 } 478 }
483 479
484 nvgpu_list_add_tail(&cur->list, &data->clients); 480 nvgpu_list_add_tail(&cur->list, &data->clients);
485 481
486 return 0; 482 return 0;
487
488failed:
489 if (cur)
490 css_gr_free_client_data(g, data, cur);
491
492 return ret;
493} 483}
494 484
495 485