Don't check if constant-sized KM_SLEEP allocations succeeded.

This commit is contained in:
pooka 2015-04-21 10:54:52 +00:00
parent b9534ae5af
commit 115eb707b4
3 changed files with 9 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_kthread.c,v 1.39 2012/09/01 00:26:37 matt Exp $ */
/* $NetBSD: kern_kthread.c,v 1.40 2015/04/21 10:54:52 pooka Exp $ */
/*-
* Copyright (c) 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.39 2012/09/01 00:26:37 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.40 2015/04/21 10:54:52 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -89,10 +89,6 @@ kthread_create(pri_t pri, int flag, struct cpu_info *ci,
}
if (fmt != NULL) {
l->l_name = kmem_alloc(MAXCOMLEN, KM_SLEEP);
if (l->l_name == NULL) {
kthread_destroy(l);
return ENOMEM;
}
va_start(ap, fmt);
vsnprintf(l->l_name, MAXCOMLEN, fmt, ap);
va_end(ap);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_physio.c,v 1.92 2011/02/10 14:46:45 pooka Exp $ */
/* $NetBSD: kern_physio.c,v 1.93 2015/04/21 10:54:52 pooka Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.92 2011/02/10 14:46:45 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.93 2015/04/21 10:54:52 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -231,8 +231,7 @@ physio(void (*strategy)(struct buf *), struct buf *obp, dev_t dev, int flags,
flags &= B_READ | B_WRITE;
if ((ps = kmem_zalloc(sizeof(*ps), KM_SLEEP)) == NULL)
return ENOMEM;
ps = kmem_zalloc(sizeof(*ps), KM_SLEEP);
/* ps->ps_running = 0; */
/* ps->ps_error = 0; */
/* ps->ps_failed = 0; */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_trans.c,v 1.31 2014/09/05 05:57:21 matt Exp $ */
/* $NetBSD: vfs_trans.c,v 1.32 2015/04/21 10:54:52 pooka Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.31 2014/09/05 05:57:21 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.32 2015/04/21 10:54:52 pooka Exp $");
/*
* File system transaction operations.
@ -165,8 +165,7 @@ fstrans_mount(struct mount *mp)
error = vfs_busy(mp, NULL);
if (error)
return error;
if ((newfmi = kmem_alloc(sizeof(*newfmi), KM_SLEEP)) == NULL)
return ENOMEM;
newfmi = kmem_alloc(sizeof(*newfmi), KM_SLEEP);
newfmi->fmi_state = FSTRANS_NORMAL;
newfmi->fmi_ref_cnt = 1;
LIST_INIT(&newfmi->fmi_cow_handler);
@ -604,8 +603,7 @@ fscow_establish(struct mount *mp, int (*func)(void *, struct buf *, bool),
fmi = mp->mnt_transinfo;
KASSERT(fmi != NULL);
if ((newch = kmem_alloc(sizeof(*newch), KM_SLEEP)) == NULL)
return ENOMEM;
newch = kmem_alloc(sizeof(*newch), KM_SLEEP);
newch->ch_func = func;
newch->ch_arg = arg;