Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Don't check if constant-sized KM_SLEEP allocations ...



details:   https://anonhg.NetBSD.org/src/rev/f73f15e00f1c
branches:  trunk
changeset: 337619:f73f15e00f1c
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Apr 21 10:54:52 2015 +0000

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

diffstat:

 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(-)

diffs (95 lines):

diff -r bd2dc5424c9b -r f73f15e00f1c sys/kern/kern_kthread.c
--- a/sys/kern/kern_kthread.c   Tue Apr 21 10:39:41 2015 +0000
+++ b/sys/kern/kern_kthread.c   Tue Apr 21 10:54:52 2015 +0000
@@ -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 @@
        }
        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 -r bd2dc5424c9b -r f73f15e00f1c sys/kern/kern_physio.c
--- a/sys/kern/kern_physio.c    Tue Apr 21 10:39:41 2015 +0000
+++ b/sys/kern/kern_physio.c    Tue Apr 21 10:54:52 2015 +0000
@@ -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 @@
 
        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 -r bd2dc5424c9b -r f73f15e00f1c sys/kern/vfs_trans.c
--- a/sys/kern/vfs_trans.c      Tue Apr 21 10:39:41 2015 +0000
+++ b/sys/kern/vfs_trans.c      Tue Apr 21 10:54:52 2015 +0000
@@ -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 @@
        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 @@
        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;
 



Home | Main Index | Thread Index | Old Index