If an error during attach caused us to detach our resources,
authorkevlo <kevlo@openbsd.org>
Mon, 9 Aug 2021 12:59:53 +0000 (12:59 +0000)
committerkevlo <kevlo@openbsd.org>
Mon, 9 Aug 2021 12:59:53 +0000 (12:59 +0000)
don't do anything on shutdown.

This fixes a panic that was reported by me on X1 Extreme Gen 1.

ok ratchov@

sys/dev/pci/azalia.c

index 94c7efe..81626e0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: azalia.c,v 1.263 2021/06/11 15:46:09 jsg Exp $        */
+/*     $OpenBSD: azalia.c,v 1.264 2021/08/09 12:59:53 kevlo Exp $      */
 /*     $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
 
 /*-
@@ -738,6 +738,9 @@ azalia_shutdown(void *v)
        azalia_t *az = (azalia_t *)v;
        uint32_t gctl;
 
+       if (az->detached)
+               return;
+
        /* disable unsolicited response */
        gctl = AZ_READ_4(az, GCTL);
        AZ_WRITE_4(az, GCTL, gctl & ~(HDA_GCTL_UNSOL));