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

Commit 14b5a2da authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ion: msm: Correct memory-region of_node reference counting"

parents 1aea8607 38a894b4
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -327,12 +327,13 @@ static int ion_sc_add_child(struct ion_sc_heap *manager,

	basep = of_get_address(phandle,  0, &size, NULL);
	if (!basep)
		goto out_free;
		goto out_put_phandle;

	base = of_translate_address(phandle, basep);
	if (base == OF_BAD_ADDR)
		goto out_free;
		goto out_put_phandle;

	of_node_put(phandle);
	heap_data.priv = dev;
	heap_data.base = base;
	heap_data.size = size;
@@ -343,16 +344,18 @@ static int ion_sc_add_child(struct ion_sc_heap *manager,
		goto out_free;

	ret = ion_sc_get_dt_token(entry, np, base, size);
	if (ret)
		goto out_free_carveout;
	if (ret) {
		ion_carveout_heap_destroy(entry->heap);
		goto out_free;
	}

	list_add(&entry->list, &manager->children);
	dev_info(dev, "ion_secure_carveout: creating heap@0x%llx, size 0x%llx\n",
		 base, size);
	return 0;

out_free_carveout:
	ion_carveout_heap_destroy(entry->heap);
out_put_phandle:
	of_node_put(phandle);
out_free:
	kfree(entry);
	return -EINVAL;
+2 −2
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ static int msm_ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
	int ret = 0;

	if (!hlos_accessible_buffer(buffer)) {
		pr_err("%s: this buffer cannot be mapped to userspace\n",
		pr_err_ratelimited("%s: this buffer cannot be mapped to userspace\n",
				   __func__);
		return -EINVAL;
	}
+2 −1
Original line number Diff line number Diff line
@@ -276,6 +276,7 @@ static void release_reserved_memory_regions(struct ion_platform_heap *heaps,

		if (mem_node)
			release_reserved_memory(dev, mem_node);
		of_node_put(mem_node);
	}
}

@@ -317,12 +318,12 @@ static int msm_ion_get_heap_dt_data(struct device_node *node,
			heap->base = base;
			heap->size = size;
		}
		of_node_put(pnode);
	} else {
		ret = 0;
	}

out:
	of_node_put(pnode);
	WARN(ret, "Failed to parse DT node for heap %s\n", heap->name);
	return ret;
}