Avoid panic from unlocking a not locked mutex (in some error cases).

Reviewed by:	ken@
This commit is contained in:
Ed Maste 2012-02-06 18:11:00 +00:00
parent 752a98b13e
commit f0e3e0350a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231092

View File

@ -221,6 +221,7 @@ cfcs_init(void)
mtx_lock(&softc->lock);
if (xpt_bus_register(softc->sim, NULL, 0) != CAM_SUCCESS) {
mtx_unlock(&softc->lock);
printf("%s: error registering SIM\n", __func__);
retval = ENOMEM;
goto bailout;
@ -230,6 +231,7 @@ cfcs_init(void)
cam_sim_path(softc->sim),
CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
mtx_unlock(&softc->lock);
printf("%s: error creating path\n", __func__);
xpt_bus_deregister(cam_sim_path(softc->sim));
retval = 1;
@ -253,8 +255,6 @@ bailout:
else if (softc->devq)
cam_simq_free(softc->devq);
mtx_unlock(&softc->lock);
return (retval);
}