Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 436d1f81 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

ion: Fail system secure heap creation if system heap is unavailable



The system secure heap relies on the existence of the system
heap. Thus, if the system heap is not available, do not create,
the system secure heap.

Change-Id: I7a99e0fda45ae02ed6e5c8a797d29e917e84f182
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 2a54c015
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -323,6 +323,12 @@ static struct ion_heap_ops system_secure_heap_ops = {
struct ion_heap *ion_system_secure_heap_create(struct ion_platform_heap *unused)
{
	struct ion_system_secure_heap *heap;
	struct ion_heap *sys_heap = get_ion_heap(ION_SYSTEM_HEAP_ID);

	if (!sys_heap) {
		pr_err("Sys heap missing; ensure it's specified in the DT, before the sys secure heap\n");
		return ERR_PTR(-EINVAL);
	}

	heap = kzalloc(sizeof(*heap), GFP_KERNEL);
	if (!heap)
@@ -330,7 +336,7 @@ struct ion_heap *ion_system_secure_heap_create(struct ion_platform_heap *unused)
	heap->heap.ion_heap.ops = &system_secure_heap_ops;
	heap->heap.ion_heap.type =
		(enum ion_heap_type)ION_HEAP_TYPE_SYSTEM_SECURE;
	heap->sys_heap = get_ion_heap(ION_SYSTEM_HEAP_ID);
	heap->sys_heap = sys_heap;

	heap->destroy_heap = false;
	heap->work_lock = __SPIN_LOCK_UNLOCKED(heap->work_lock);