[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200504210004.GB102727@google.com>
Date: Mon, 4 May 2020 14:00:04 -0700
From: Benson Leung <bleung@...gle.com>
To: Enric Balletbo i Serra <enric.balletbo@...labora.com>
Cc: linux-kernel@...r.kernel.org,
Collabora Kernel ML <kernel@...labora.com>,
groeck@...omium.org, bleung@...omium.org, dtor@...omium.org,
gwendal@...omium.org
Subject: Re: [PATCH] platform/chrome: cros_usbpd_logger: Add __printf
annotation to append_str()
Hi Enric,
On Tue, Apr 14, 2020 at 10:12:39PM +0200, Enric Balletbo i Serra wrote:
> 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 <enric.balletbo@...labora.com>
Applied for chrome-platform-5.8. You'll find it in the for-kernelci branch
very shortly.
Benson
> ---
>
> 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 7de3ea75ef46..d16931203d82 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.25.1
>
--
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@...gle.com
Chromium OS Project
bleung@...omium.org
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists