Module Name:    src
Committed By:   hans
Date:           Sun Mar 23 12:08:13 UTC 2025

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

Log Message:
ums(4): make sure the device is enabled before calling uhidev_close()

Same issue as in uts(4), his check was already there, but only enabled
for DIAGNOSTIC kernels.  The check and early return are always needed,
but the message should only be printed in DIAGNOSTIC kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/usb/ums.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/ums.c
diff -u src/sys/dev/usb/ums.c:1.106 src/sys/dev/usb/ums.c:1.107
--- src/sys/dev/usb/ums.c:1.106	Mon Mar 18 15:15:27 2024
+++ src/sys/dev/usb/ums.c	Sun Mar 23 12:08:13 2025
@@ -1,4 +1,5 @@
-/*	$NetBSD: ums.c,v 1.106 2024/03/18 15:15:27 jakllsch Exp $	*/
+
+/*	$NetBSD: ums.c,v 1.107 2025/03/23 12:08:13 hans Exp $	*/
 
 /*
  * Copyright (c) 1998, 2017 The NetBSD Foundation, Inc.
@@ -35,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.106 2024/03/18 15:15:27 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.107 2025/03/23 12:08:13 hans Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -375,12 +376,12 @@ ums_disable(void *v)
 
 	UMSHIST_FUNC(); UMSHIST_CALLARGS("sc=%jx\n", (uintptr_t)sc, 0, 0, 0);
 
-#ifdef DIAGNOSTIC
 	if (!sc->sc_enabled) {
+#ifdef DIAGNOSTIC
 		printf("ums_disable: not enabled\n");
+#endif
 		return;
 	}
-#endif
 
 	if (sc->sc_enabled) {
 		sc->sc_enabled = 0;

Reply via email to