diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2020-09-04 18:29:59 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2020-09-04 18:29:59 +0000 |
| commit | a16e001bd98ccb82b6e634ed5e05a3415ae7fd13 (patch) | |
| tree | dad3534be194ead9e690fe546afc0f95f27d868b /sys/dev/usb/storage | |
| parent | ed75ef34d43fbcb1b0bea2f96cbc7d76b096fa75 (diff) | |
Notes
Diffstat (limited to 'sys/dev/usb/storage')
| -rw-r--r-- | sys/dev/usb/storage/umass.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c index 546d524cdf35..cfec3fc91fc1 100644 --- a/sys/dev/usb/storage/umass.c +++ b/sys/dev/usb/storage/umass.c @@ -2063,6 +2063,7 @@ static int umass_cam_attach_sim(struct umass_softc *sc) { struct cam_devq *devq; /* Per device Queue */ + cam_status status; /* * A HBA is attached to the CAM layer. @@ -2091,11 +2092,12 @@ umass_cam_attach_sim(struct umass_softc *sc) } mtx_lock(&sc->sc_mtx); - - if (xpt_bus_register(sc->sc_sim, sc->sc_dev, - sc->sc_unit) != CAM_SUCCESS) { + status = xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit); + if (status != CAM_SUCCESS) { cam_sim_free(sc->sc_sim, /* free_devq */ TRUE); mtx_unlock(&sc->sc_mtx); + printf("%s: xpt_bus_register failed with status %#x\n", + __func__, status); return (ENOMEM); } mtx_unlock(&sc->sc_mtx); @@ -2121,14 +2123,22 @@ umass_cam_attach(struct umass_softc *sc) static void umass_cam_detach_sim(struct umass_softc *sc) { + cam_status status; + if (sc->sc_sim != NULL) { - if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) { + status = xpt_bus_deregister(cam_sim_path(sc->sc_sim)); + if (status == CAM_REQ_CMP) { /* accessing the softc is not possible after this */ sc->sc_sim->softc = NULL; + DPRINTF(sc, UDMASS_SCSI, "%s: %s:%d:%d caling " + "cam_sim_free sim %p refc %u mtx %p\n", + __func__, sc->sc_name, cam_sim_path(sc->sc_sim), + sc->sc_unit, sc->sc_sim, + sc->sc_sim->refcount, sc->sc_sim->mtx); cam_sim_free(sc->sc_sim, /* free_devq */ TRUE); } else { - panic("%s: CAM layer is busy\n", - sc->sc_name); + panic("%s: %s: CAM layer is busy: %#x\n", + __func__, sc->sc_name, status); } sc->sc_sim = NULL; } |
