Module Name:    src
Committed By:   hans
Date:           Sun Mar 23 12:07:24 UTC 2025

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

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

This check was already there, but only enabled for DIAGNOSTIC kernels.
The check and early return is always needed, but the message should only
be printed in DIAGNOSTIC kernels.

Fixes PR kern/59206


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/uts.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/uts.c
diff -u src/sys/dev/usb/uts.c:1.16 src/sys/dev/usb/uts.c:1.17
--- src/sys/dev/usb/uts.c:1.16	Wed May 10 00:12:44 2023
+++ src/sys/dev/usb/uts.c	Sun Mar 23 12:07:24 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: uts.c,v 1.16 2023/05/10 00:12:44 riastradh Exp $	*/
+/*	$NetBSD: uts.c,v 1.17 2025/03/23 12:07:24 hans Exp $	*/
 
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uts.c,v 1.16 2023/05/10 00:12:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uts.c,v 1.17 2025/03/23 12:07:24 hans Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -331,12 +331,12 @@ uts_disable(void *v)
 	struct uts_softc *sc = v;
 
 	DPRINTFN(1,("uts_disable: sc=%p\n", sc));
-#ifdef DIAGNOSTIC
 	if (!sc->sc_enabled) {
+#ifdef DIAGNOSTIC
 		printf("uts_disable: not enabled\n");
+#endif
 		return;
 	}
-#endif
 
 	sc->sc_enabled = 0;
 	uhidev_close(sc->sc_hdev);

Reply via email to