summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2000-12-04 22:46:50 +0000
committerwpaul <wpaul@FreeBSD.org>2000-12-04 22:46:50 +0000
commit9e208c7442e565fc1de970045410945e52702467 (patch)
tree3933565b0c0070018517c21c29b3ccc39d115ccb /sys/dev
parente01a4c0fd9aff88ae8d9b70d8f82aaf56c9c9116 (diff)
downloadFreeBSD-src-9e208c7442e565fc1de970045410945e52702467.zip
FreeBSD-src-9e208c7442e565fc1de970045410945e52702467.tar.gz
Initialize/grab the mutex earlier in the attach phase, so that
bailing out to the fail: label where we release/destroy the mutex will work without exploding.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/dc/if_dc.c5
-rw-r--r--sys/dev/sf/if_sf.c4
-rw-r--r--sys/dev/sk/if_sk.c5
-rw-r--r--sys/dev/ti/if_ti.c6
-rw-r--r--sys/dev/vr/if_vr.c5
5 files changed, 14 insertions, 11 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index a23706a..a07c4dc 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -1770,6 +1770,9 @@ static int dc_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct dc_softc));
+ mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_DEF);
+ DC_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -1833,8 +1836,6 @@ static int dc_attach(dev)
goto fail;
}
- mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_DEF);
- DC_LOCK(sc);
/* Need this info to decide on a chip type. */
sc->dc_info = dc_devtype(dev);
revision = pci_read_config(dev, DC_PCI_CFRV, 4) & 0x000000FF;
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index f2ca1e8..aa33e7d 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -679,6 +679,8 @@ static int sf_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct sf_softc));
+ mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_DEF);
+ SF_LOCK(sc);
/*
* Handle power management nonsense.
*/
@@ -765,8 +767,6 @@ static int sf_attach(dev)
}
callout_handle_init(&sc->sf_stat_ch);
- mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_DEF);
- SF_LOCK(sc);
/* Reset the adapter. */
sf_reset(sc);
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c
index befe974..143c4e4 100644
--- a/sys/dev/sk/if_sk.c
+++ b/sys/dev/sk/if_sk.c
@@ -1194,6 +1194,9 @@ static int sk_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct sk_softc));
+ mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_DEF);
+ SK_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -1279,8 +1282,6 @@ static int sk_attach(dev)
goto fail;
}
- mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_DEF);
- SK_LOCK(sc);
/* Reset the adapter. */
sk_reset(sc);
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index 1a88f0d..7f6660f 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -1476,6 +1476,9 @@ static int ti_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct ti_softc));
+ mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_DEF);
+ TI_LOCK(sc);
+
/*
* Map control/status registers.
*/
@@ -1527,9 +1530,6 @@ static int ti_attach(dev)
goto fail;
}
- mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_DEF);
- TI_LOCK(sc);
-
sc->ti_unit = unit;
if (ti_chipinit(sc)) {
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c
index 38677fd..a1fa0c0 100644
--- a/sys/dev/vr/if_vr.c
+++ b/sys/dev/vr/if_vr.c
@@ -643,6 +643,9 @@ static int vr_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct vr_softc *));
+ mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_DEF);
+ VR_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -728,8 +731,6 @@ static int vr_attach(dev)
goto fail;
}
- mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_DEF);
- VR_LOCK(sc);
/* Reset the adapter. */
vr_reset(sc);
OpenPOWER on IntegriCloud