NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amd64/59180: System reboots instead of shutting down



Can you please try a kernel with the attached patch and see if it
solves the problem?

(If you need, I can provide a prebuilt kernel with this patch.)
# HG changeset patch
# User Taylor R Campbell <riastradh%NetBSD.org@localhost>
# Date 1742134550 0
#      Sun Mar 16 14:15:50 2025 +0000
# Branch trunk
# Node ID 3f8a61dfed92d463627e7bbf859c24f0255dd5aa
# Parent  4c220187a0cad6a0dbb2b1ceeda3067ff430b505
# EXP-Topic riastradh-pr59180-failedohcidetachpanic
ohci(4): Handle failed attach when we detach.

PR port-amd64/59180: System reboots instead of shutting down

diff -r 4c220187a0ca -r 3f8a61dfed92 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c	Thu Mar 13 18:41:34 2025 +0000
+++ b/sys/dev/usb/ohci.c	Sun Mar 16 14:15:50 2025 +0000
@@ -373,6 +373,9 @@ ohci_detach(struct ohci_softc *sc, int f
 {
 	int rv = 0;
 
+	if (!sc->sc_attached)
+		return 0;
+
 	if (sc->sc_child != NULL)
 		rv = config_detach(sc->sc_child, flags);
 
@@ -1092,6 +1095,7 @@ ohci_init(ohci_softc_t *sc)
 	DPRINTF("enabling %#jx", sc->sc_eintrs | OHCI_MIE, 0, 0, 0);
 	OWRITE4(sc, OHCI_INTERRUPT_ENABLE, sc->sc_eintrs | OHCI_MIE);
 
+	sc->sc_attached = true;
 	return 0;
 
  bad5:
diff -r 4c220187a0ca -r 3f8a61dfed92 sys/dev/usb/ohcivar.h
--- a/sys/dev/usb/ohcivar.h	Thu Mar 13 18:41:34 2025 +0000
+++ b/sys/dev/usb/ohcivar.h	Sun Mar 16 14:15:50 2025 +0000
@@ -90,6 +90,7 @@ typedef struct ohci_softc {
 	bus_space_tag_t iot;
 	bus_space_handle_t ioh;
 	bus_size_t sc_size;
+	bool sc_attached;
 
 	kmutex_t sc_lock;
 	kmutex_t sc_intr_lock;


Home | Main Index | Thread Index | Old Index