Remove NULL checks after M_WAITOK allocations from firewire.
MFC after: 1 month Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
aa3ec63e02
commit
256a4cb9d7
@ -102,8 +102,6 @@ fwdev_allocbuf(struct firewire_comm *fc, struct fw_xferq *q,
|
|||||||
|
|
||||||
q->bulkxfer = malloc(sizeof(struct fw_bulkxfer) * b->nchunk,
|
q->bulkxfer = malloc(sizeof(struct fw_bulkxfer) * b->nchunk,
|
||||||
M_FW, M_WAITOK);
|
M_FW, M_WAITOK);
|
||||||
if (q->bulkxfer == NULL)
|
|
||||||
return (ENOMEM);
|
|
||||||
|
|
||||||
b->psize = roundup2(b->psize, sizeof(uint32_t));
|
b->psize = roundup2(b->psize, sizeof(uint32_t));
|
||||||
q->buf = fwdma_malloc_multiseg(fc, sizeof(uint32_t),
|
q->buf = fwdma_malloc_multiseg(fc, sizeof(uint32_t),
|
||||||
@ -179,8 +177,6 @@ fw_open(struct cdev *dev, int flags, int fmt, fw_proc *td)
|
|||||||
FW_GUNLOCK(sc->fc);
|
FW_GUNLOCK(sc->fc);
|
||||||
|
|
||||||
dev->si_drv1 = malloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO);
|
dev->si_drv1 = malloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO);
|
||||||
if (dev->si_drv1 == NULL)
|
|
||||||
return (ENOMEM);
|
|
||||||
|
|
||||||
if ((dev->si_flags & SI_NAMED) == 0) {
|
if ((dev->si_flags & SI_NAMED) == 0) {
|
||||||
int unit = DEV2UNIT(dev);
|
int unit = DEV2UNIT(dev);
|
||||||
@ -742,10 +738,6 @@ out:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fwb = malloc(sizeof(struct fw_bind), M_FW, M_WAITOK);
|
fwb = malloc(sizeof(struct fw_bind), M_FW, M_WAITOK);
|
||||||
if (fwb == NULL) {
|
|
||||||
err = ENOMEM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fwb->start = ((u_int64_t)bindreq->start.hi << 32) |
|
fwb->start = ((u_int64_t)bindreq->start.hi << 32) |
|
||||||
bindreq->start.lo;
|
bindreq->start.lo;
|
||||||
fwb->end = fwb->start + bindreq->len;
|
fwb->end = fwb->start + bindreq->len;
|
||||||
|
@ -160,10 +160,6 @@ fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment,
|
|||||||
}
|
}
|
||||||
am = (struct fwdma_alloc_multi *)malloc(sizeof(struct fwdma_alloc_multi)
|
am = (struct fwdma_alloc_multi *)malloc(sizeof(struct fwdma_alloc_multi)
|
||||||
+ sizeof(struct fwdma_seg)*nseg, M_FW, M_WAITOK);
|
+ sizeof(struct fwdma_seg)*nseg, M_FW, M_WAITOK);
|
||||||
if (am == NULL) {
|
|
||||||
printf("fwdma_malloc_multiseg: malloc failed\n");
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
am->ssize = ssize;
|
am->ssize = ssize;
|
||||||
am->esize = esize;
|
am->esize = esize;
|
||||||
am->nseg = 0;
|
am->nseg = 0;
|
||||||
|
@ -287,8 +287,6 @@ fwmem_open(struct cdev *dev, int flags, int fmt, fw_proc *td)
|
|||||||
FW_GUNLOCK(sc->fc);
|
FW_GUNLOCK(sc->fc);
|
||||||
dev->si_drv1 = malloc(sizeof(struct fwmem_softc),
|
dev->si_drv1 = malloc(sizeof(struct fwmem_softc),
|
||||||
M_FWMEM, M_WAITOK);
|
M_FWMEM, M_WAITOK);
|
||||||
if (dev->si_drv1 == NULL)
|
|
||||||
return (ENOMEM);
|
|
||||||
dev->si_iosize_max = DFLTPHYS;
|
dev->si_iosize_max = DFLTPHYS;
|
||||||
fms = dev->si_drv1;
|
fms = dev->si_drv1;
|
||||||
bcopy(&fwmem_eui64, &fms->eui, sizeof(struct fw_eui64));
|
bcopy(&fwmem_eui64, &fms->eui, sizeof(struct fw_eui64));
|
||||||
|
@ -1247,10 +1247,6 @@ fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
|
|||||||
db_tr = (struct fwohcidb_tr *)
|
db_tr = (struct fwohcidb_tr *)
|
||||||
malloc(sizeof(struct fwohcidb_tr) * dbch->ndb,
|
malloc(sizeof(struct fwohcidb_tr) * dbch->ndb,
|
||||||
M_FW, M_WAITOK | M_ZERO);
|
M_FW, M_WAITOK | M_ZERO);
|
||||||
if (db_tr == NULL) {
|
|
||||||
printf("fwohci_db_init: malloc(1) failed\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DB_SIZE(x) (sizeof(struct fwohcidb) * (x)->ndesc)
|
#define DB_SIZE(x) (sizeof(struct fwohcidb) * (x)->ndesc)
|
||||||
dbch->am = fwdma_malloc_multiseg(&sc->fc, sizeof(struct fwohcidb),
|
dbch->am = fwdma_malloc_multiseg(&sc->fc, sizeof(struct fwohcidb),
|
||||||
|
@ -307,10 +307,6 @@ fwe_init(void *arg)
|
|||||||
xferq->bulkxfer = (struct fw_bulkxfer *) malloc(
|
xferq->bulkxfer = (struct fw_bulkxfer *) malloc(
|
||||||
sizeof(struct fw_bulkxfer) * xferq->bnchunk,
|
sizeof(struct fw_bulkxfer) * xferq->bnchunk,
|
||||||
M_FWE, M_WAITOK);
|
M_FWE, M_WAITOK);
|
||||||
if (xferq->bulkxfer == NULL) {
|
|
||||||
printf("if_fwe: malloc failed\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
STAILQ_INIT(&xferq->stvalid);
|
STAILQ_INIT(&xferq->stvalid);
|
||||||
STAILQ_INIT(&xferq->stfree);
|
STAILQ_INIT(&xferq->stfree);
|
||||||
STAILQ_INIT(&xferq->stdma);
|
STAILQ_INIT(&xferq->stdma);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user