Commit c53ab613 authored by Lucas Stach's avatar Lucas Stach

drm/etnaviv: fix etnaviv_cmdbuf_suballoc_new return value

The call site expects to get either a valid suballoc or an error
pointer, so a NULL return will not be treated as an error. Make
sure to always return a proper error pointer in case something goes
wrong.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: default avatarGuido Günther <agx@sigxcpu.org>
parent 2e737e52
...@@ -49,8 +49,10 @@ etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu) ...@@ -49,8 +49,10 @@ etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu)
suballoc->vaddr = dma_alloc_wc(gpu->dev, SUBALLOC_SIZE, suballoc->vaddr = dma_alloc_wc(gpu->dev, SUBALLOC_SIZE,
&suballoc->paddr, GFP_KERNEL); &suballoc->paddr, GFP_KERNEL);
if (!suballoc->vaddr) if (!suballoc->vaddr) {
ret = -ENOMEM;
goto free_suballoc; goto free_suballoc;
}
ret = etnaviv_iommu_get_suballoc_va(gpu, suballoc->paddr, ret = etnaviv_iommu_get_suballoc_va(gpu, suballoc->paddr,
&suballoc->vram_node, SUBALLOC_SIZE, &suballoc->vram_node, SUBALLOC_SIZE,
...@@ -65,7 +67,7 @@ etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu) ...@@ -65,7 +67,7 @@ etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu)
free_suballoc: free_suballoc:
kfree(suballoc); kfree(suballoc);
return NULL; return ERR_PTR(ret);
} }
void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc) void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment