summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-02-27 21:22:09 +0000
committerriastradh <riastradh@NetBSD.org>2022-02-27 21:22:09 +0000
commit121c497fe85daef79d91e721bf2882a2feef0d9c (patch)
tree3121f1c6b7969df14accbe7363c0e981bc4ac157 /sys
parentccb6d7589028ff8994f0597b3c8fb80f1289716b (diff)
acpi: Assert acpi_register_notify is not called twice.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 3d955d536d4..000553f8a83 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.296 2022/01/22 11:49:17 thorpej Exp $ */
+/* $NetBSD: acpi.c,v 1.297 2022/02/27 21:22:09 riastradh Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.296 2022/01/22 11:49:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.297 2022/02/27 21:22:09 riastradh Exp $");
#include "pci.h"
#include "opt_acpi.h"
@@ -1222,6 +1222,11 @@ acpi_register_notify(struct acpi_devnode *ad, ACPI_NOTIFY_HANDLER notify)
if (ad == NULL || notify == NULL)
goto fail;
+ KASSERTMSG(ad->ad_notify == NULL,
+ "%s: ACPI node %s already has notify handler: %p",
+ ad->ad_device ? device_xname(ad->ad_device) : "(unknown)",
+ ad->ad_name,
+ ad->ad_notify);
atomic_store_release(&ad->ad_notify, notify);
return true;