drm/tegra: gem: Do not return NULL in tegra_bo_mmap()
It's confusing for a function to return NULL and ERR_PTR()-encoded error codes on failure. Make sure we only ever return the latter since that's what callers already expect. Reported-by: Sui Jingfeng <suijingfeng@loongson.cn> Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://patchwork.freedesktop.org/patch/msgid/ZSVuVcqdGfGtQIQj@orome.fritz.box
This commit is contained in:
@@ -178,6 +178,7 @@ static void *tegra_bo_mmap(struct host1x_bo *bo)
|
||||
{
|
||||
struct tegra_bo *obj = host1x_to_tegra_bo(bo);
|
||||
struct iosys_map map = { 0 };
|
||||
void *vaddr;
|
||||
int ret;
|
||||
|
||||
if (obj->vaddr)
|
||||
@@ -185,10 +186,18 @@ static void *tegra_bo_mmap(struct host1x_bo *bo)
|
||||
|
||||
if (obj->gem.import_attach) {
|
||||
ret = dma_buf_vmap_unlocked(obj->gem.import_attach->dmabuf, &map);
|
||||
return ret ? NULL : map.vaddr;
|
||||
if (ret < 0)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
return map.vaddr;
|
||||
}
|
||||
|
||||
return vmap(obj->pages, obj->num_pages, VM_MAP, pgprot_writecombine(PAGE_KERNEL));
|
||||
vaddr = vmap(obj->pages, obj->num_pages, VM_MAP,
|
||||
pgprot_writecombine(PAGE_KERNEL));
|
||||
if (!vaddr)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
static void tegra_bo_munmap(struct host1x_bo *bo, void *addr)
|
||||
|
||||
Reference in New Issue
Block a user