Module Name:    src
Committed By:   riastradh
Date:           Sat Sep  2 17:42:47 UTC 2023

Modified Files:
        src/sys/dev/usb: ukbd.c

Log Message:
ukbd(4): Fix ordering in ukbd_cnpollc exit.

This is probably an MP-safety issue waiting to happen, but let's at
least make the wind and unwind sequences mirror images.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/usb/ukbd.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/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.162 src/sys/dev/usb/ukbd.c:1.163
--- src/sys/dev/usb/ukbd.c:1.162	Tue Jan 10 18:20:10 2023
+++ src/sys/dev/usb/ukbd.c	Sat Sep  2 17:42:47 2023
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.162 2023/01/10 18:20:10 mrg Exp $        */
+/*      $NetBSD: ukbd.c,v 1.163 2023/09/02 17:42:47 riastradh Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.162 2023/01/10 18:20:10 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.163 2023/09/02 17:42:47 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1055,11 +1055,12 @@ ukbd_cnpollc(void *v, int on)
 	if (on) {
 		sc->sc_spl = splusb();
 		pollenter++;
-	} else {
-		splx(sc->sc_spl);
-		pollenter--;
 	}
 	usbd_set_polling(dev, on);
+	if (!on) {
+		pollenter--;
+		splx(sc->sc_spl);
+	}
 }
 
 int

Reply via email to