From 115eb707b4a49555985c110934d214926c806a7f Mon Sep 17 00:00:00 2001 From: pooka Date: Tue, 21 Apr 2015 10:54:52 +0000 Subject: [PATCH] Don't check if constant-sized KM_SLEEP allocations succeeded. --- sys/kern/kern_kthread.c | 8 ++------ sys/kern/kern_physio.c | 7 +++---- sys/kern/vfs_trans.c | 10 ++++------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 660af53854bd..7e133db671ff 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -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 -__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 #include @@ -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); diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c index 7b4234d9f582..4e8f147a5453 100644 --- a/sys/kern/kern_physio.c +++ b/sys/kern/kern_physio.c @@ -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 -__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 #include @@ -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; */ diff --git a/sys/kern/vfs_trans.c b/sys/kern/vfs_trans.c index d3fa312fa875..973c71aef765 100644 --- a/sys/kern/vfs_trans.c +++ b/sys/kern/vfs_trans.c @@ -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 -__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;