From 68d3cbb5ddf9a6072d491136e35a4dc3ca544f07 Mon Sep 17 00:00:00 2001 From: Elliott Mitchell Date: Mon, 26 Jun 2023 17:11:49 -0700 Subject: [PATCH] kern/intr: use swi_add() string as name if no handler If swi_add() is used to initialize an event without adding a handler, the name should be used as the device name. Otherwise there can be mysterious unnamed events lying around. --- sys/kern/kern_intr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index bbc0671d1c384f..77ac8e3a93b76b 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -1089,7 +1089,9 @@ swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, return (EINVAL); } else { error = intr_event_create(&ie, NULL, ieflags, 0, - NULL, NULL, NULL, swi_assign_cpu, "swi%d:", pri); + NULL, NULL, NULL, swi_assign_cpu, + handler == NULL && name != NULL ? "%2$s swi%1$d:" : "swi%d", + pri, name); if (error) return (error); if (eventp != NULL)