r600g: fix crash when file in R600_TRACE doesn't exist
authorConstantine Charlamov <Hi-Angel@yandex.ru>
Sat, 24 Jun 2017 12:52:05 +0000 (15:52 +0300)
committerDave Airlie <airlied@redhat.com>
Mon, 26 Jun 2017 07:39:54 +0000 (17:39 +1000)
…and print error in such case. Which probably is not a rare event btw
because fopen doesn't expand ~ to $HOME.

Also get rid of unused "bool ret" variable.

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_hw_context.c

index 9b01e8e7d5cb9da752fb75c6d4925f588a27a319..ca7f41db68622db82c2616f120b0e4d3e8f172db 100644 (file)
@@ -295,15 +295,16 @@ void r600_context_gfx_flush(void *context, unsigned flags,
        ctx->b.num_gfx_cs_flushes++;
 
        if (ctx->is_debug) {
-               bool ret = ws->fence_wait(ws, ctx->b.last_gfx_fence, 10000000);
-               if (ret == false) {
+               if (!ws->fence_wait(ws, ctx->b.last_gfx_fence, 10000000)) {
                        const char *fname = getenv("R600_TRACE");
                        if (!fname)
                                exit(-1);
                        FILE *fl = fopen(fname, "w+");
-                       if (fl)
+                       if (fl) {
                                eg_dump_debug_state(&ctx->b.b, fl, 0);
-                       fclose(fl);
+                               fclose(fl);
+                       } else
+                               perror(fname);
                        exit(-1);
                }
        }