From 61fb57fb9c912a91750dfc377423f514b67df5cd Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Thu, 18 Oct 2018 12:19:54 +0300 Subject: [PATCH] gpu: nvgpu: add format specifiers for debug output Add compiler attribute to gk20a_debug_output to type check the printf style arguments against the format string. Jira NVGPU-886 Change-Id: Ib0c36826bf0a05211c873dc54ad9177319354b65 Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1929865 Reviewed-by: svc-misra-checker Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/debug.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/nvgpu/include/nvgpu/debug.h b/drivers/gpu/nvgpu/include/nvgpu/debug.h index 33bf62155..167fb2934 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/debug.h +++ b/drivers/gpu/nvgpu/include/nvgpu/debug.h @@ -39,6 +39,7 @@ struct gk20a_debug_output { #ifdef CONFIG_DEBUG_FS extern unsigned int gk20a_debug_trace_cmdbuf; +__attribute__((format (printf, 2, 3))) void gk20a_debug_output(struct gk20a_debug_output *o, const char *fmt, ...); @@ -50,6 +51,7 @@ void gk20a_init_debug_ops(struct gpu_ops *gops); void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink); void gk20a_debug_deinit(struct gk20a *g); #else +__attribute__((format (printf, 2, 3))) static inline void gk20a_debug_output(struct gk20a_debug_output *o, const char *fmt, ...) {}