Cleanup on the etnaviv_open() failure path looks incomplete in that the context id is left allocated. Fix it by adding proper onion unwind.
Signed-off-by: Tvrtko Ursulin <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Russell King <[email protected]> Cc: Christian Gmeiner <[email protected]> Cc: [email protected] --- Compile tested only. And as I cannot see that these ids are used anywhere I am not marking this as a fix. --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index ec1352c1b09f..7bd7aef723c3 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -79,7 +79,7 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file) priv->cmdbuf_suballoc); if (!ctx->mmu) { ret = -ENOMEM; - goto out_free; + goto out_id; } for (i = 0; i < ETNA_MAX_PIPES; i++) { @@ -98,6 +98,8 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file) return 0; +out_id: + xa_erase(&priv->active_contexts, ctx->id); out_free: kfree(ctx); return ret; -- 2.56.0
