From ee2377b879e8ae1faadb44cc7f174b151af4ad4a Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Mon, 16 Jan 2023 10:38:29 +0530 Subject: [PATCH] gpu: nvgpu: fix uninitialized pointer Destroy the profile lock in the if block that initializes the pointer profile. CID 10165006 CID 631480 Change-Id: I16935723c1cacf6434d4cb79a1671f5422d814e7 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2844111 Reviewed-by: svcacv Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Sachin Nikam Reviewed-by: Ankur Kishore GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/scale.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/scale.c b/drivers/gpu/nvgpu/os/linux/scale.c index 9942f242f..5170badec 100644 --- a/drivers/gpu/nvgpu/os/linux/scale.c +++ b/drivers/gpu/nvgpu/os/linux/scale.c @@ -1,7 +1,7 @@ /* * gk20a clock scaling profile * - * Copyright (c) 2013-2022, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2013-2023, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -653,9 +653,9 @@ void gk20a_scale_exit(struct device *dev) if (err) { nvgpu_err(g, "failed to remove max freq notifier %d", err); } - } - nvgpu_mutex_destroy(&profile->lock); + nvgpu_mutex_destroy(&profile->lock); + } #else if (platform->qos_notify) { pm_qos_remove_min_notifier(PM_QOS_GPU_FREQ_BOUNDS,