etnaviv: Fix assert when try to accumulate an invalid fd
authorMarco Felsch <m.felsch@pengutronix.de>
Thu, 5 Dec 2019 16:04:11 +0000 (17:04 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 14 Jan 2020 17:40:10 +0000 (17:40 +0000)
Check if it is a valid fd before merging it to the context's fd.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3381>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3381>

src/gallium/drivers/etnaviv/etnaviv_fence.c

index c0684bccf299ac4d5d3d36643132a03807b51048..b2400b6aca3d0e3a01c78138990bcc6526a3dd82 100644 (file)
@@ -88,7 +88,8 @@ etna_fence_server_sync(struct pipe_context *pctx,
 {
    struct etna_context *ctx = etna_context(pctx);
 
-   sync_accumulate("etnaviv", &ctx->in_fence_fd, pfence->fence_fd);
+   if (pfence->fence_fd != -1)
+      sync_accumulate("etnaviv", &ctx->in_fence_fd, pfence->fence_fd);
 }
 
 static int