Forráskód Böngészése

Merge "audio_ssr: Mutex dead lock"

qctecmdr 1 éve
szülő
commit
843ddedcd2
1 módosított fájl, 5 hozzáadás és 5 törlés
  1. 5 5
      dsp/audio_notifier.c

+ 5 - 5
dsp/audio_notifier.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2016-2017, 2020-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/init.h>
@@ -246,8 +246,10 @@ static int audio_notifier_dereg_service(int service, int domain)
 		__func__, service_data[service][domain].name,
 		service_data[service][domain].handle);
 
+	mutex_lock(&notifier_mutex);
 	service_data[service][domain].state = AUDIO_NOTIFIER_SERVICE_DOWN;
 	service_data[service][domain].handle = NULL;
+	mutex_unlock(&notifier_mutex);
 done:
 	return ret;
 }
@@ -459,16 +461,16 @@ static int audio_notifier_service_cb(unsigned long opcode,
 		__func__, service_data[service][domain].name, notifier_opcode);
 
 	mutex_lock(&notifier_mutex);
-
 	service_data[service][domain].state = notifier_opcode;
+
 	ret = srcu_notifier_call_chain(&service_data[service][domain].
 		client_nb_list, notifier_opcode, &data);
+	mutex_unlock(&notifier_mutex);
 	if (ret < 0)
 		pr_err_ratelimited("%s: srcu_notifier_call_chain returned %d, service %s, \
 			opcode 0x%lx\n", __func__, ret, service_data[service][domain].name,
 			notifier_opcode);
 
-	mutex_unlock(&notifier_mutex);
 
 	return NOTIFY_OK;
 }
@@ -506,7 +508,6 @@ int audio_notifier_deregister(char *client_name)
 		ret = -EINVAL;
 		goto done;
 	}
-	mutex_lock(&notifier_mutex);
 	list_for_each_safe(ptr, next, &client_list) {
 		client_data = list_entry(ptr, struct client_data, list);
 		if (!strcmp(client_name, client_data->client_name)) {
@@ -523,7 +524,6 @@ int audio_notifier_deregister(char *client_name)
 			kfree(client_data);
 		}
 	}
-	mutex_unlock(&notifier_mutex);
 done:
 	return ret;
 }