diff mbox series

PNP: add printf attribute to log function

Message ID 20201221160302.3752887-1-trix@redhat.com (mailing list archive)
State Mainlined, archived
Headers show
Series PNP: add printf attribute to log function | expand

Commit Message

Tom Rix Dec. 21, 2020, 4:03 p.m. UTC
From: Tom Rix <trix@redhat.com>

Attributing the function allows the compiler to more thoroughly
check the use of the function with -Wformat and similar flags.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/pnp/interface.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Rafael J. Wysocki Jan. 22, 2021, 3:21 p.m. UTC | #1
On Mon, Dec 21, 2020 at 5:04 PM <trix@redhat.com> wrote:
>
> From: Tom Rix <trix@redhat.com>
>
> Attributing the function allows the compiler to more thoroughly
> check the use of the function with -Wformat and similar flags.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/pnp/interface.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
> index 187e4a1175b0..602c46893e83 100644
> --- a/drivers/pnp/interface.c
> +++ b/drivers/pnp/interface.c
> @@ -33,6 +33,7 @@ struct pnp_info_buffer {
>
>  typedef struct pnp_info_buffer pnp_info_buffer_t;
>
> +__printf(2, 3)
>  static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt, ...)
>  {
>         va_list args;
> --

Applied as 5.12 material, thanks!
diff mbox series

Patch

diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 187e4a1175b0..602c46893e83 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -33,6 +33,7 @@  struct pnp_info_buffer {
 
 typedef struct pnp_info_buffer pnp_info_buffer_t;
 
+__printf(2, 3)
 static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt, ...)
 {
 	va_list args;