Module Name:    src
Committed By:   riastradh
Date:           Fri Jan 14 22:28:42 UTC 2022

Modified Files:
        src/sys/dev/i2c: ims.c

Log Message:
ims(4): Sprinkle KERNEL_LOCKED_P assertions.

Access to the softc and hidms state is currently kernel-locked.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/ims.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/i2c/ims.c
diff -u src/sys/dev/i2c/ims.c:1.3 src/sys/dev/i2c/ims.c:1.4
--- src/sys/dev/i2c/ims.c:1.3	Tue Jul  9 12:56:30 2019
+++ src/sys/dev/i2c/ims.c	Fri Jan 14 22:28:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ims.c,v 1.3 2019/07/09 12:56:30 ryoon Exp $ */
+/* $NetBSD: ims.c,v 1.4 2022/01/14 22:28:42 riastradh Exp $ */
 /* $OpenBSD ims.c,v 1.1 2016/01/12 01:11:15 jcs Exp $ */
 
 /*
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ims.c,v 1.3 2019/07/09 12:56:30 ryoon Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ims.c,v 1.4 2022/01/14 22:28:42 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -158,11 +158,13 @@ ims_detach(device_t self, int flags)
 	return rv;
 }
 
-void 
+void
 ims_childdet(device_t self, device_t child)
 {
 	struct ims_softc *sc = device_private(self);
 
+	KASSERT(KERNEL_LOCKED_P());
+
 	KASSERT(sc->sc_ms.hidms_wsmousedev == child);
 	sc->sc_ms.hidms_wsmousedev = NULL;
 }
@@ -184,6 +186,8 @@ ims_enable(void *v)
 	struct ims_softc *sc = v;
 	int error;
 
+	KASSERT(KERNEL_LOCKED_P());
+
 	if (sc->sc_enabled)
 		return EBUSY;
 
@@ -201,6 +205,8 @@ ims_disable(void *v)
 {
 	struct ims_softc *sc = v;
 
+	KASSERT(KERNEL_LOCKED_P());
+
 #ifdef DIAGNOSTIC
 	if (!sc->sc_enabled) {
 		printf("ums_disable: not enabled\n");

Reply via email to