Fix a potential problem when mfi_get_log_state and only

release a command if one was allocated.
Also release the command in mfi_shutdown.
This commit is contained in:
Paul Saab 2006-06-20 23:08:35 +00:00
parent c0b332d17a
commit e94bb9b26e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159812

View File

@ -577,7 +577,7 @@ mfi_get_controller_info(struct mfi_softc *sc)
static int
mfi_get_log_state(struct mfi_softc *sc, struct mfi_evt_log_state **log_state)
{
struct mfi_command *cm;
struct mfi_command *cm = NULL;
int error;
mtx_lock(&sc->mfi_io_lock);
@ -602,7 +602,8 @@ mfi_get_log_state(struct mfi_softc *sc, struct mfi_evt_log_state **log_state)
bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap);
out:
mfi_release_command(cm);
if (cm)
mfi_release_command(cm);
mtx_unlock(&sc->mfi_io_lock);
return (error);
@ -822,6 +823,7 @@ mfi_shutdown(struct mfi_softc *sc)
device_printf(sc->mfi_dev, "Failed to shutdown controller\n");
}
mfi_release_command(cm);
return (error);
}