From bbb7ad49b8350b79261ce087c8e101d92f15533d Mon Sep 17 00:00:00 2001 From: Enric Balletbo i Serra Date: Tue, 14 Apr 2020 22:12:39 +0200 Subject: [PATCH] platform/chrome: cros_usbpd_logger: Add __printf annotation to append_str() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This allows the compiler to verify the format strings vs the types of the arguments. Also, silence the warning (triggered by W=1): cros_usbpd_logger.c:55:2: warning: function ‘append_str’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] Signed-off-by: Enric Balletbo i Serra Signed-off-by: Benson Leung --- drivers/platform/chrome/cros_usbpd_logger.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c index 7de3ea75ef46e..d16931203d821 100644 --- a/drivers/platform/chrome/cros_usbpd_logger.c +++ b/drivers/platform/chrome/cros_usbpd_logger.c @@ -46,6 +46,7 @@ static const char * const fault_names[] = { "---", "OCP", "fast OCP", "OVP", "Discharge" }; +__printf(3, 4) static int append_str(char *buf, int pos, const char *fmt, ...) { va_list args; -- 2.30.2