Date: Mon, 27 Jul 2020 14:28:55 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363608 - in head/sys/dev: mpr mps Message-ID: <202007271428.06REStR3075987@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Mon Jul 27 14:28:55 2020 New Revision: 363608 URL: https://svnweb.freebsd.org/changeset/base/363608 Log: 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 Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_user.c head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_user.c Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Mon Jul 27 14:25:10 2020 (r363607) +++ head/sys/dev/mpr/mpr.c Mon Jul 27 14:28:55 2020 (r363608) @@ -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 *mas 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); Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Mon Jul 27 14:25:10 2020 (r363607) +++ head/sys/dev/mpr/mpr_sas.c Mon Jul 27 14:28:55 2020 (r363608) @@ -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 maxta 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); - } } Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Mon Jul 27 14:25:10 2020 (r363607) +++ head/sys/dev/mpr/mpr_user.c Mon Jul 27 14:28:55 2020 (r363608) @@ -1528,13 +1528,6 @@ mpr_diag_register(struct mpr_softc *sc, mpr_fw_diag_re 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; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Mon Jul 27 14:25:10 2020 (r363607) +++ head/sys/dev/mps/mps.c Mon Jul 27 14:28:55 2020 (r363608) @@ -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); Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Mon Jul 27 14:25:10 2020 (r363607) +++ head/sys/dev/mps/mps_sas.c Mon Jul 27 14:28:55 2020 (r363608) @@ -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 maxta 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); - } } Modified: head/sys/dev/mps/mps_user.c ============================================================================== --- head/sys/dev/mps/mps_user.c Mon Jul 27 14:25:10 2020 (r363607) +++ head/sys/dev/mps/mps_user.c Mon Jul 27 14:28:55 2020 (r363608) @@ -1436,13 +1436,6 @@ mps_diag_register(struct mps_softc *sc, mps_fw_diag_re 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007271428.06REStR3075987>