mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
Merge "ion: msm: Correct memory-region of_node reference counting"
This commit is contained in:
commit
14b5a2da73
3 changed files with 13 additions and 9 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -283,8 +283,8 @@ 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",
|
||||
__func__);
|
||||
pr_err_ratelimited("%s: this buffer cannot be mapped to userspace\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue