Commit 16faaf52 by Julian Brown Committed by Thomas Schwinge

[OpenACC] Missing unlocking on error paths in attach/detach code

	libgomp/
	* oacc-mem.c (acc_attach_async): Add missing gomp_mutex_unlock on
	error path.
	(goacc_detach_internal): Likewise.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit dc9541545d9e5705a97c41713c557f55522b54dc)
parent 96bfb6e1
...@@ -887,7 +887,10 @@ acc_attach_async (void **hostaddr, int async) ...@@ -887,7 +887,10 @@ acc_attach_async (void **hostaddr, int async)
n = splay_tree_lookup (&acc_dev->mem_map, &cur_node); n = splay_tree_lookup (&acc_dev->mem_map, &cur_node);
if (n == NULL) if (n == NULL)
gomp_fatal ("struct not mapped for acc_attach"); {
gomp_mutex_unlock (&acc_dev->lock);
gomp_fatal ("struct not mapped for acc_attach");
}
gomp_attach_pointer (acc_dev, aq, &acc_dev->mem_map, n, (uintptr_t) hostaddr, gomp_attach_pointer (acc_dev, aq, &acc_dev->mem_map, n, (uintptr_t) hostaddr,
0, NULL); 0, NULL);
...@@ -920,7 +923,10 @@ goacc_detach_internal (void **hostaddr, int async, bool finalize) ...@@ -920,7 +923,10 @@ goacc_detach_internal (void **hostaddr, int async, bool finalize)
n = splay_tree_lookup (&acc_dev->mem_map, &cur_node); n = splay_tree_lookup (&acc_dev->mem_map, &cur_node);
if (n == NULL) if (n == NULL)
gomp_fatal ("struct not mapped for acc_detach"); {
gomp_mutex_unlock (&acc_dev->lock);
gomp_fatal ("struct not mapped for acc_detach");
}
gomp_detach_pointer (acc_dev, aq, n, (uintptr_t) hostaddr, finalize, NULL); gomp_detach_pointer (acc_dev, aq, n, (uintptr_t) hostaddr, finalize, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment