From 8fa68aeb045e8974a295a6d1f7d30f127398a8d2 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 19 Jan 2017 15:35:47 -0800 Subject: gpu: nvgpu: Free nvgpu_clk_dev in case of error If nvgpu_clk_arb_install_fd() gets an error from nvgpu_clk_notification_queue_alloc(), it fails to free the nvgpu_clk_dev that it allocated earlier. Direct the error case to call an appropriate fail label. Coverity ID 1862040 Change-Id: I1d804d4f5261ec64831938f997f9efc3f2700b60 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1291683 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/clk/clk_arb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/clk/clk_arb.c b/drivers/gpu/nvgpu/clk/clk_arb.c index 2dee209e..550c77e0 100644 --- a/drivers/gpu/nvgpu/clk/clk_arb.c +++ b/drivers/gpu/nvgpu/clk/clk_arb.c @@ -477,9 +477,10 @@ static int nvgpu_clk_arb_install_fd(struct gk20a *g, status = nvgpu_clk_notification_queue_alloc(&dev->queue, DEFAULT_EVENT_NUMBER); - if (status < 0) - return status; - + if (status < 0) { + err = status; + goto fail; + } fd = get_unused_fd_flags(O_RDWR); if (fd < 0) { -- cgit v1.2.2