Module Name: src
Committed By: riastradh
Date: Tue Aug 23 15:16:44 UTC 2022
Modified Files:
src/sys/dev/usb: xhci.c
Log Message:
xhci(4): Fix error branch for failed suspend.
If suspend failed, at least we can stop it from blocking all
subsequent xhci commands or making a second suspend crash.
To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.167 src/sys/dev/usb/xhci.c:1.168
--- src/sys/dev/usb/xhci.c:1.167 Tue May 24 20:50:19 2022
+++ src/sys/dev/usb/xhci.c Tue Aug 23 15:16:44 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.167 2022/05/24 20:50:19 andvar Exp $ */
+/* $NetBSD: xhci.c,v 1.168 2022/08/23 15:16:44 riastradh Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.167 2022/05/24 20:50:19 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.168 2022/08/23 15:16:44 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -896,6 +896,16 @@ xhci_suspend(device_t self, const pmf_qu
ok = true;
out: mutex_exit(&sc->sc_rhlock);
+ if (!ok) {
+ /*
+ * If suspend failed, resume command issuance.
+ */
+ mutex_enter(&sc->sc_lock);
+ KASSERT(sc->sc_suspender == curlwp);
+ sc->sc_suspender = NULL;
+ cv_broadcast(&sc->sc_cmdbusy_cv);
+ mutex_exit(&sc->sc_lock);
+ }
return ok;
}