From b6b71bd4a82d5a8734b9e703ea2468297fbe9645 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 28 Nov 2017 23:35:57 -0800 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1606977 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c') 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, u32 perfmon_count, struct gk20a_cs_snapshot_client *cur) { - int ret = 0; - memset(cur->snapshot, 0, sizeof(*cur->snapshot)); cur->snapshot->start = sizeof(*cur->snapshot); /* 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, if (cur->perfmon_count && g->ops.css.allocate_perfmon_ids) { cur->perfmon_start = g->ops.css.allocate_perfmon_ids(data, cur->perfmon_count); - if (!cur->perfmon_start) { - ret = -ENOENT; - goto failed; - } + if (!cur->perfmon_start) + return -ENOENT; } nvgpu_list_add_tail(&cur->list, &data->clients); return 0; - -failed: - if (cur) - css_gr_free_client_data(g, data, cur); - - return ret; } -- cgit v1.2.2