Skip to content

Commit

Permalink
platform/chrome: cros_usbpd_logger: Add __printf annotation to append…
Browse files Browse the repository at this point in the history
…_str()

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>
Signed-off-by: Benson Leung <bleung@chromium.org>
  • Loading branch information
Enric Balletbo i Serra authored and Benson Leung committed May 4, 2020
1 parent c032699 commit bbb7ad4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/platform/chrome/cros_usbpd_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bbb7ad4

Please sign in to comment.