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

This commit is contained in:
qctecmdr 2019-09-26 11:14:33 -07:00 • committed by Gerrit - the friendly Code Review server
commit 14b5a2da73
3 changed files with 13 additions and 9 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}