Module Name: src Committed By: riastradh Date: Sun Feb 27 21:22:10 UTC 2022
Modified Files: src/sys/dev/acpi: acpi.c Log Message: acpi: Assert acpi_register_notify is not called twice. To generate a diff of this commit: cvs rdiff -u -r1.296 -r1.297 src/sys/dev/acpi/acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/acpi.c diff -u src/sys/dev/acpi/acpi.c:1.296 src/sys/dev/acpi/acpi.c:1.297 --- src/sys/dev/acpi/acpi.c:1.296 Sat Jan 22 11:49:17 2022 +++ src/sys/dev/acpi/acpi.c Sun Feb 27 21:22:09 2022 @@ -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 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;