public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: cros_usbpd_logger: Add __printf annotation to append_str()
@ 2020-04-14 20:12 Enric Balletbo i Serra
  2020-05-04 21:00 ` Benson Leung
  0 siblings, 1 reply; 2+ messages in thread
From: Enric Balletbo i Serra @ 2020-04-14 20:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Collabora Kernel ML, groeck, bleung, dtor, gwendal

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>
---

 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/chrome: cros_usbpd_logger: Add __printf annotation to append_str()
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Benson Leung @ 2020-05-04 21:00 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, Collabora Kernel ML, groeck, bleung, dtor, gwendal

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-04 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox