From 57d9a51d455900946f3eac18b8d1d77cb03b972c Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Mon, 10 Feb 2020 16:09:31 +0800 Subject: [PATCH] lima: move dump check to macro for lima_dump_command_stream_print This can prevent the execution of some function like lima_ctx_buff_va which is passed in as parameter when no dump case. Reviewed-by: Vasily Khoruzhick Signed-off-by: Qiang Yu Part-of: --- src/gallium/drivers/lima/lima_util.c | 7 ++----- src/gallium/drivers/lima/lima_util.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/lima/lima_util.c b/src/gallium/drivers/lima/lima_util.c index 4ad88f5829a..dca9307c991 100644 --- a/src/gallium/drivers/lima/lima_util.c +++ b/src/gallium/drivers/lima/lima_util.c @@ -165,12 +165,9 @@ lima_dump_free(struct lima_dump *dump) } void -lima_dump_command_stream_print(struct lima_dump *dump, void *data, - int size, bool is_float, const char *fmt, ...) +_lima_dump_command_stream_print(struct lima_dump *dump, void *data, + int size, bool is_float, const char *fmt, ...) { - if (!dump) - return; - va_list ap; va_start(ap, fmt); vfprintf(dump->fp, fmt, ap); diff --git a/src/gallium/drivers/lima/lima_util.h b/src/gallium/drivers/lima/lima_util.h index 30c97d2f872..3749523f3a1 100644 --- a/src/gallium/drivers/lima/lima_util.h +++ b/src/gallium/drivers/lima/lima_util.h @@ -45,7 +45,13 @@ void lima_dump_rsw_command_stream_print(struct lima_dump *dump, void *data, int size, uint32_t start); void lima_dump_texture_descriptor(struct lima_dump *dump, void *data, int size, uint32_t start, uint32_t offset); -void lima_dump_command_stream_print(struct lima_dump *dump, void *data, - int size, bool is_float, const char *fmt, ...); + +void _lima_dump_command_stream_print(struct lima_dump *dump, void *data, + int size, bool is_float, const char *fmt, ...); +#define lima_dump_command_stream_print(dump, ...) \ + do { \ + if (dump) \ + _lima_dump_command_stream_print(dump, __VA_ARGS__); \ + } while (0) #endif -- 2.30.2