]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
NTB: Clean up safely if attach fails early
authorcem <cem@FreeBSD.org>
Tue, 20 Oct 2015 01:54:52 +0000 (01:54 +0000)
committercem <cem@FreeBSD.org>
Tue, 20 Oct 2015 01:54:52 +0000 (01:54 +0000)
Sponsored by: EMC / Isilon Storage Division

sys/dev/ntb/ntb_hw/ntb_hw.c

index af261526992003f7318702cd3f3ee9cb4a349f61..a675d1bc2e5f295cc46b862718cbd8f95df15bcf 100644 (file)
@@ -543,7 +543,8 @@ ntb_detach(device_t device)
 
        ntb = DEVICE2SOFTC(device);
 
-       ntb_db_set_mask(ntb, ntb->db_valid_mask);
+       if (ntb->self_reg != NULL)
+               ntb_db_set_mask(ntb, ntb->db_valid_mask);
        callout_drain(&ntb->heartbeat_timer);
        callout_drain(&ntb->lr_timer);
        if (ntb->type == NTB_XEON)
@@ -1108,7 +1109,8 @@ static void
 ntb_teardown_xeon(struct ntb_softc *ntb)
 {
 
-       ntb_link_disable(ntb);
+       if (ntb->reg != NULL)
+               ntb_link_disable(ntb);
 }
 
 static void