}
softc = kmalloc(sizeof(*softc), M_DEVBUF, M_WAITOK | M_ZERO);
- if (softc == NULL) {
- kprintf("sgregister: Unable to allocate softc\n");
- return (CAM_REQ_CMP_ERR);
- }
-
softc->state = SG_STATE_NORMAL;
softc->pd_type = SID_TYPE(&cgd->inq_data);
softc->sg_timeout = SG_DEFAULT_TIMEOUT / SG_DEFAULT_HZ * hz;
if (newcard) {
ivar = kmalloc(sizeof(struct mmc_ivars), M_DEVBUF,
M_WAITOK | M_ZERO);
- if (!ivar)
- return;
memcpy(ivar->raw_cid, raw_cid, sizeof(raw_cid));
}
if (mmcbr_get_ro(sc->dev))
if (ioc->buf_size > 0) {
ioc_buf = kmalloc(ioc->buf_size, M_MFIBUF, M_WAITOK);
- if (ioc_buf == NULL) {
- return (ENOMEM);
- }
error = copyin(ioc->buf, ioc_buf, ioc->buf_size);
if (error) {
device_printf(sc->mfi_dev, "failed to copyin\n");
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/dev/sound/pcm/buffer.c,v 1.25.2.3 2007/04/26 08:21:43 ariff Exp $
- * $DragonFly: src/sys/dev/sound/pcm/buffer.c,v 1.11 2008/01/06 16:55:51 swildner Exp $
*/
#include <dev/sound/pcm/sound.h>
chn_unlock(b->channel);
tmpbuf = kmalloc(blkcnt * blksz, M_DEVBUF, M_WAITOK);
- if (tmpbuf == NULL)
- return ENOMEM;
chn_lock(b->channel);
b->blkcnt = blkcnt;
b->blksz = blksz;
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/dev/sound/pcm/feeder.c,v 1.33.2.3 2006/03/07 15:51:19 jhb Exp $
- * $DragonFly: src/sys/dev/sound/pcm/feeder.c,v 1.6 2007/01/04 21:47:03 corecode Exp $
*/
#include <dev/sound/pcm/sound.h>
SLIST_INIT(&feedertab);
fte = kmalloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO);
- if (fte == NULL) {
- kprintf("can't allocate memory for root feeder: %s\n",
- fc->name);
-
- return;
- }
fte->feederclass = fc;
fte->desc = NULL;
fte->idx = feedercnt;
while ((feedercnt < MAXFEEDERS) && (fc->desc[i].type > 0)) {
/* kprintf("adding feeder %s, %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); */
fte = kmalloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO);
- if (fte == NULL) {
- kprintf("can't allocate memory for feeder '%s', %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out);
-
- return;
- }
fte->feederclass = fc;
fte->desc = &fc->desc[i];
fte->idx = feedercnt;
* testing revisions.
*
* $FreeBSD: src/sys/dev/sound/pcm/feeder_rate.c,v 1.11.2.2 2006/01/29 02:27:28 ariff Exp $
- * $DragonFly: src/sys/dev/sound/pcm/feeder_rate.c,v 1.5 2007/01/04 21:47:03 corecode Exp $
*/
#include <dev/sound/pcm/sound.h>
struct feed_rate_info *info;
info = kmalloc(sizeof(*info), M_RATEFEEDER, M_WAITOK | M_ZERO);
- if (info == NULL)
- return ENOMEM;
/*
* bufsz = sample from last cycle + conversion space
*/
info->bufsz = 2 + feeder_rate_buffersize;
info->buffer = kmalloc(sizeof(*info->buffer) * info->bufsz,
M_RATEFEEDER, M_WAITOK | M_ZERO);
- if (info->buffer == NULL) {
- kfree(info, M_RATEFEEDER);
- return ENOMEM;
- }
info->rsrc = DSP_DEFAULT_SPEED;
info->rdst = DSP_DEFAULT_SPEED;
f->data = info;
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/link_elf.c,v 1.24 1999/12/24 15:33:36 bde Exp $
- * $DragonFly: src/sys/kern/link_elf.c,v 1.29 2008/08/01 23:11:16 dillon Exp $
*/
#include <sys/param.h>
* Read the elf header from the file.
*/
hdr = kmalloc(sizeof(*hdr), M_LINKER, M_WAITOK);
- if (hdr == NULL) {
- error = ENOMEM;
- goto out;
- }
error = vn_rdwr(UIO_READ, vp, (void *)hdr, sizeof(*hdr), 0,
UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
if (error)
goto out;
}
shdr = kmalloc(nbytes, M_LINKER, M_WAITOK);
- if (shdr == NULL) {
- error = ENOMEM;
- goto out;
- }
ef->e_shdr = shdr;
error = vn_rdwr(UIO_READ, vp, (caddr_t) shdr, nbytes, hdr->e_shoff,
UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid);
panic("msginfo.msgseg > 32767");
}
- if (msgmaps == NULL)
- panic("msgmaps is NULL");
-
for (i = 0; i < msginfo.msgseg; i++) {
if (i > 0)
msgmaps[i-1].next = i;
free_msgmaps = 0;
nfree_msgmaps = msginfo.msgseg;
- if (msghdrs == NULL)
- panic("msghdrs is NULL");
-
for (i = 0; i < msginfo.msgtql; i++) {
msghdrs[i].msg_type = 0;
if (i > 0)
}
free_msghdrs = &msghdrs[0];
- if (msqids == NULL)
- panic("msqids is NULL");
-
for (i = 0; i < msginfo.msgmni; i++) {
msqids[i].msg_qbytes = 0; /* implies entry is available */
msqids[i].msg_perm.seq = 0; /* reset to a known value */
* Allow malloc to fail in case pmap would be exhausted.
*/
buf = kmalloc(pref->pref_len + 1, M_TEMP, M_WAITOK);
- if (buf == NULL)
- return (ENOMEM);
error = copyin(pref->pref_plist, buf, pref->pref_len);
if (error) {
kfree(buf, M_TEMP);
return;
}
p = kmalloc(new_max * sizeof(*pfi_buffer), PFI_MTYPE, M_WAITOK);
- if (p == NULL) {
- kprintf("pfi_address_add: no memory to grow buffer "
- "(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX);
- return;
- }
memcpy(pfi_buffer, p, pfi_buffer_cnt * sizeof(*pfi_buffer));
/* no need to zero buffer */
kfree(pfi_buffer, PFI_MTYPE);
/* allocate and fill new struct pf_tagname */
tag = kmalloc(sizeof(*tag), M_TEMP, M_WAITOK);
- if (tag == NULL)
- return (0);
strlcpy(tag->name, tagname, sizeof(tag->name));
tag->tag = new_tagid;
tag->ref++;
error = EBUSY;
break;
}
- rule = kmalloc(sizeof(struct pf_rule), M_PFRULEPL,M_WAITOK);
- if (rule == NULL) {
- error = ENOMEM;
- break;
- }
+ rule = kmalloc(sizeof(struct pf_rule), M_PFRULEPL, M_WAITOK);
bcopy(&pr->rule, rule, sizeof(struct pf_rule));
rule->cuid = ap->a_cred->cr_ruid;
rule->cpid = 0;
struct hook_desc *hdp;
hdp = kmalloc(sizeof (*hdp), M_DEVBUF, M_WAITOK);
- if (hdp == NULL)
- return (NULL);
-
hdp->hd_fn = fn;
hdp->hd_arg = arg;
if (tail)
crypto_drivers_num = CRYPTO_DRIVERS_INITIAL;
crypto_drivers = kmalloc(crypto_drivers_num * sizeof(struct cryptocap),
M_CRYPTO_DATA, M_WAITOK | M_ZERO);
- if (crypto_drivers == NULL) {
- kprintf("crypto_init: cannot malloc driver table\n");
- error = ENOMEM;
- goto bad;
- }
for (n = 0; n < ncpus; ++n) {
tdinfo = &tdinfo_array[n];
newdrv = kmalloc(2 * crypto_drivers_num *
sizeof(struct cryptocap),
M_CRYPTO_DATA, M_WAITOK|M_ZERO);
- if (newdrv == NULL) {
- CRYPTO_DRIVER_UNLOCK();
- kprintf("crypto: no space to expand driver table!\n");
- return -1;
- }
bcopy(crypto_drivers, newdrv,
crypto_drivers_num * sizeof(struct cryptocap));
struct csession *cse;
cse = kmalloc(sizeof(struct csession), M_XDATA, M_WAITOK | M_ZERO);
- if (cse == NULL)
- return NULL;
lockinit(&cse->lock, "cryptodev", 0, LK_CANRECURSE);
cse->key = key;
cse->keylen = keylen/8;