summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/etnaviv
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2019-07-05 19:15:35 +0200
committerLucas Stach <l.stach@pengutronix.de>2019-08-09 11:06:38 +0200
commitc53ab61312ceb2c2c8fdf50137361a77ef0fc155 (patch)
treeb921c1b0586f783fb65072586530fc0585621f51 /drivers/gpu/drm/etnaviv
parent2e737e520548d4456fc8dfa800ab189e0e4b2939 (diff)
downloadtalos-op-linux-c53ab61312ceb2c2c8fdf50137361a77ef0fc155.tar.gz
talos-op-linux-c53ab61312ceb2c2c8fdf50137361a77ef0fc155.zip
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: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Guido Günther <agx@sigxcpu.org>
Diffstat (limited to 'drivers/gpu/drm/etnaviv')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c
index bdc35c0d4e79..4d0f95452cf0 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c
@@ -49,8 +49,10 @@ etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu)
suballoc->vaddr = dma_alloc_wc(gpu->dev, SUBALLOC_SIZE,
&suballoc->paddr, GFP_KERNEL);
- if (!suballoc->vaddr)
+ if (!suballoc->vaddr) {
+ ret = -ENOMEM;
goto free_suballoc;
+ }
ret = etnaviv_iommu_get_suballoc_va(gpu, suballoc->paddr,
&suballoc->vram_node, SUBALLOC_SIZE,
@@ -65,7 +67,7 @@ free_dma:
free_suballoc:
kfree(suballoc);
- return NULL;
+ return ERR_PTR(ret);
}
void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc)
OpenPOWER on IntegriCloud