Skip to contentSkip to conversation

workqueue: add printf attribute to __alloc_workqueue()

PATCH Applied Su Hui 2 participants 2 messages Dec 24, 2024

Subsystems (2)
lore
Share & tools
lore

Su Hui

author
#0 lore raw

PATCH 1/1 workqueue: add printf attribute to __alloc_workqueue()

Fix a compiler warning with W=1:
kernel/workqueue.c: error:
function ‘__alloc_workqueue’ might be a candidate for ‘gnu_printf’ format attribute[-Werror=suggest-attribute=format]

 5657 |  name_len = vsnprintf(wq->name, sizeof(wq->name), fmt, args);
      |  ^~~~~~~~
Fixes 9b59a85a84dc ("workqueue: Don't call va_start / va_end twice")
---
 kernel/workqueue.c | 1 +
 1 file changed, 1 insertion(+)
kernel/workqueue.c +1 -0
index 8b07576814a5..0c752812ae09 100644
@@ -5641,6 +5641,7 @@ static void wq_adjust_max_active(struct workqueue_struct *wq)
 	} while (activated);
 }
 
+__printf(1, 0)
 static struct workqueue_struct *__alloc_workqueue(const char *fmt,
 						  unsigned int flags,
 						  int max_active, va_list args)
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 9 lines · Su Hui

Fix a compiler warning with W=1:
kernel/workqueue.c: error:
function ‘__alloc_workqueue’ might be a candidate for ‘gnu_printf’ format attribute[-Werror=suggest-attribute=format]

 5657 |  name_len = vsnprintf(wq->name, sizeof(wq->name), fmt, args);
      |  ^~~~~~~~
Fixes 9b59a85a84dc ("workqueue: Don't call va_start / va_end twice")

Applied to wq/for-6.13-fixes.

Thanks.

Signature · 1 line
tejun