Skip to contentSkip to conversation

PNP: add printf attribute to log function

PATCH Applied [email protected] 2 participants 2 messages Dec 21, 2020 – Jan 22, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PNP: add printf attribute to log function

From: Tom Rix <[email protected]>

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

---
 drivers/pnp/interface.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pnp/interface.c +1 -0
index 187e4a1175b0..602c46893e83 100644
@@ -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;
Signature · 1 line
2.27.0
maintainer Applied
#1 lore raw
Quoted 16 lines · On Mon, Dec 21, 2020 at 5:04 PM <[email protected]> wrote:

From: Tom Rix <[email protected]>

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

---
 drivers/pnp/interface.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pnp/interface.c +0 -0
index 187e4a1175b0..602c46893e83 100644

drivers/pnp/interface.c struct pnp_info_buffer {

Quoted 8 lines
drivers/pnp/interface.c +1 -1
@@ -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!