From: Benson Leung <bleung@google.com>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: linux-kernel@vger.kernel.org,
Collabora Kernel ML <kernel@collabora.com>,
groeck@chromium.org, bleung@chromium.org, dtor@chromium.org,
gwendal@chromium.org
Subject: Re: [PATCH] platform/chrome: cros_usbpd_logger: Add __printf annotation to append_str()
Date: Mon, 4 May 2020 14:00:04 -0700 [thread overview]
Message-ID: <20200504210004.GB102727@google.com> (raw)
In-Reply-To: <20200414201239.1506922-1-enric.balletbo@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]
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@collabora.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@google.com
Chromium OS Project
bleung@chromium.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2020-05-04 21:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 20:12 [PATCH] platform/chrome: cros_usbpd_logger: Add __printf annotation to append_str() Enric Balletbo i Serra
2020-05-04 21:00 ` Benson Leung [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200504210004.GB102727@google.com \
--to=bleung@google.com \
--cc=bleung@chromium.org \
--cc=dtor@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=groeck@chromium.org \
--cc=gwendal@chromium.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.