mpr(4), mps(4): Stop checking for failures from malloc(M_WAITOK).
PR: 240545 Submitted by: Andrew Reiter <arr@watson.org> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25766
This commit is contained in:
parent
782ebde52e
commit
d2a5f0812b
@ -1529,10 +1529,6 @@ mpr_alloc_requests(struct mpr_softc *sc)
|
||||
*/
|
||||
sc->commands = malloc(sizeof(struct mpr_command) * sc->num_reqs,
|
||||
M_MPR, M_WAITOK | M_ZERO);
|
||||
if (!sc->commands) {
|
||||
mpr_dprint(sc, MPR_ERROR, "Cannot allocate command memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
for (i = 1; i < sc->num_reqs; i++) {
|
||||
cm = &sc->commands[i];
|
||||
cm->cm_req = sc->req_frames + i * sc->reqframesz;
|
||||
@ -2684,11 +2680,6 @@ mpr_register_events(struct mpr_softc *sc, uint8_t *mask,
|
||||
int error = 0;
|
||||
|
||||
eh = malloc(sizeof(struct mpr_event_handle), M_MPR, M_WAITOK|M_ZERO);
|
||||
if (!eh) {
|
||||
mpr_dprint(sc, MPR_EVENT|MPR_ERROR,
|
||||
"Cannot allocate event memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
eh->callback = cb;
|
||||
eh->data = data;
|
||||
TAILQ_INSERT_TAIL(&sc->event_list, eh, eh_list);
|
||||
|
@ -736,11 +736,6 @@ mpr_attach_sas(struct mpr_softc *sc)
|
||||
mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__);
|
||||
|
||||
sassc = malloc(sizeof(struct mprsas_softc), M_MPR, M_WAITOK|M_ZERO);
|
||||
if (!sassc) {
|
||||
mpr_dprint(sc, MPR_INIT|MPR_ERROR,
|
||||
"Cannot allocate SAS subsystem memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX MaxTargets could change during a reinit. Since we don't
|
||||
@ -751,12 +746,6 @@ mpr_attach_sas(struct mpr_softc *sc)
|
||||
sassc->maxtargets = sc->facts->MaxTargets + sc->facts->MaxVolumes;
|
||||
sassc->targets = malloc(sizeof(struct mprsas_target) *
|
||||
sassc->maxtargets, M_MPR, M_WAITOK|M_ZERO);
|
||||
if (!sassc->targets) {
|
||||
mpr_dprint(sc, MPR_INIT|MPR_ERROR,
|
||||
"Cannot allocate SAS target memory\n");
|
||||
free(sassc, M_MPR);
|
||||
return (ENOMEM);
|
||||
}
|
||||
sc->sassc = sassc;
|
||||
sassc->sc = sc;
|
||||
|
||||
@ -3556,8 +3545,4 @@ mprsas_realloc_targets(struct mpr_softc *sc, int maxtargets)
|
||||
|
||||
sassc->targets = malloc(sizeof(struct mprsas_target) * maxtargets,
|
||||
M_MPR, M_WAITOK|M_ZERO);
|
||||
if (!sassc->targets) {
|
||||
panic("%s failed to alloc targets with error %d\n",
|
||||
__func__, ENOMEM);
|
||||
}
|
||||
}
|
||||
|
@ -1528,13 +1528,6 @@ mpr_diag_register(struct mpr_softc *sc, mpr_fw_diag_register_t *diag_register,
|
||||
bzero(sc->fw_diag_buffer, buffer_size);
|
||||
|
||||
ctx = malloc(sizeof(*ctx), M_MPR, M_WAITOK | M_ZERO);
|
||||
if (ctx == NULL) {
|
||||
device_printf(sc->mpr_dev, "%s: context malloc failed\n",
|
||||
__func__);
|
||||
*return_code = MPR_FW_DIAG_ERROR_NO_BUFFER;
|
||||
status = MPR_DIAG_FAILURE;
|
||||
goto bailout;
|
||||
}
|
||||
ctx->addr = &sc->fw_diag_busaddr;
|
||||
ctx->buffer_dmat = sc->fw_diag_dmat;
|
||||
ctx->buffer_dmamap = sc->fw_diag_map;
|
||||
|
@ -1520,10 +1520,6 @@ mps_alloc_requests(struct mps_softc *sc)
|
||||
*/
|
||||
sc->commands = malloc(sizeof(struct mps_command) * sc->num_reqs,
|
||||
M_MPT2, M_WAITOK | M_ZERO);
|
||||
if(!sc->commands) {
|
||||
mps_dprint(sc, MPS_ERROR, "Cannot allocate command memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
for (i = 1; i < sc->num_reqs; i++) {
|
||||
cm = &sc->commands[i];
|
||||
cm->cm_req = sc->req_frames + i * sc->reqframesz;
|
||||
@ -2598,10 +2594,6 @@ mps_register_events(struct mps_softc *sc, u32 *mask,
|
||||
int error = 0;
|
||||
|
||||
eh = malloc(sizeof(struct mps_event_handle), M_MPT2, M_WAITOK|M_ZERO);
|
||||
if(!eh) {
|
||||
mps_dprint(sc, MPS_ERROR, "Cannot allocate event memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
eh->callback = cb;
|
||||
eh->data = data;
|
||||
TAILQ_INSERT_TAIL(&sc->event_list, eh, eh_list);
|
||||
|
@ -722,11 +722,6 @@ mps_attach_sas(struct mps_softc *sc)
|
||||
mps_dprint(sc, MPS_INIT, "%s entered\n", __func__);
|
||||
|
||||
sassc = malloc(sizeof(struct mpssas_softc), M_MPT2, M_WAITOK|M_ZERO);
|
||||
if(!sassc) {
|
||||
mps_dprint(sc, MPS_INIT|MPS_ERROR,
|
||||
"Cannot allocate SAS controller memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX MaxTargets could change during a reinit. Since we don't
|
||||
@ -737,12 +732,6 @@ mps_attach_sas(struct mps_softc *sc)
|
||||
sassc->maxtargets = sc->facts->MaxTargets + sc->facts->MaxVolumes;
|
||||
sassc->targets = malloc(sizeof(struct mpssas_target) *
|
||||
sassc->maxtargets, M_MPT2, M_WAITOK|M_ZERO);
|
||||
if(!sassc->targets) {
|
||||
mps_dprint(sc, MPS_INIT|MPS_ERROR,
|
||||
"Cannot allocate SAS target memory\n");
|
||||
free(sassc, M_MPT2);
|
||||
return (ENOMEM);
|
||||
}
|
||||
sc->sassc = sassc;
|
||||
sassc->sc = sc;
|
||||
|
||||
@ -3421,8 +3410,4 @@ mpssas_realloc_targets(struct mps_softc *sc, int maxtargets)
|
||||
|
||||
sassc->targets = malloc(sizeof(struct mpssas_target) * maxtargets,
|
||||
M_MPT2, M_WAITOK|M_ZERO);
|
||||
if (!sassc->targets) {
|
||||
panic("%s failed to alloc targets with error %d\n",
|
||||
__func__, ENOMEM);
|
||||
}
|
||||
}
|
||||
|
@ -1436,13 +1436,6 @@ mps_diag_register(struct mps_softc *sc, mps_fw_diag_register_t *diag_register,
|
||||
bzero(sc->fw_diag_buffer, buffer_size);
|
||||
|
||||
ctx = malloc(sizeof(*ctx), M_MPSUSER, M_WAITOK | M_ZERO);
|
||||
if (ctx == NULL) {
|
||||
device_printf(sc->mps_dev, "%s: context malloc failed\n",
|
||||
__func__);
|
||||
*return_code = MPS_FW_DIAG_ERROR_NO_BUFFER;
|
||||
status = MPS_DIAG_FAILURE;
|
||||
goto bailout;
|
||||
}
|
||||
ctx->addr = &sc->fw_diag_busaddr;
|
||||
ctx->buffer_dmat = sc->fw_diag_dmat;
|
||||
ctx->buffer_dmamap = sc->fw_diag_map;
|
||||
|
Loading…
Reference in New Issue
Block a user