Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Simplify a bit



details:   https://anonhg.NetBSD.org/src/rev/de80827f6e81
branches:  trunk
changeset: 797235:de80827f6e81
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Jul 10 19:21:46 2014 +0000

description:
Simplify a bit

diffstat:

 sys/kern/sys_module.c |  23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diffs (78 lines):

diff -r f3c8b2dda706 -r de80827f6e81 sys/kern/sys_module.c
--- a/sys/kern/sys_module.c     Thu Jul 10 19:12:07 2014 +0000
+++ b/sys/kern/sys_module.c     Thu Jul 10 19:21:46 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_module.c,v 1.15 2014/07/10 19:12:07 maxv Exp $     */
+/*     $NetBSD: sys_module.c,v 1.16 2014/07/10 19:21:46 maxv Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.15 2014/07/10 19:12:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.16 2014/07/10 19:21:46 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,36 +62,35 @@
 
        if ((ml->ml_props != NULL && ml->ml_propslen == 0) ||
            (ml->ml_props == NULL && ml->ml_propslen > 0)) {
-               error = EINVAL;
-               goto out1;
+               return EINVAL;
        }
 
        path = PNBUF_GET();
        error = copyinstr(ml->ml_filename, path, MAXPATHLEN, NULL);
        if (error != 0)
-               goto out2;
+               goto out1;
 
        if (ml->ml_props != NULL) {
                if (ml->ml_propslen > MAXPROPSLEN) {
                        error = ENOMEM;
-                       goto out2;
+                       goto out1;
                }
                propslen = ml->ml_propslen + 1;
 
                props = (char *)kmem_alloc(propslen, KM_SLEEP);
                if (props == NULL) {
                        error = ENOMEM;
-                       goto out2;
+                       goto out1;
                }
 
                error = copyinstr(ml->ml_props, props, propslen, NULL);
                if (error != 0)
-                       goto out3;
+                       goto out2;
 
                dict = prop_dictionary_internalize(props);
                if (dict == NULL) {
                        error = EINVAL;
-                       goto out3;
+                       goto out2;
                }
        } else {
                dict = NULL;
@@ -104,14 +103,12 @@
                prop_object_release(dict);
        }
 
-out3:
+out2:
        if (props != NULL) {
                kmem_free(props, propslen);
        }
-out2:
+out1:
        PNBUF_PUT(path);
-out1:
-
        return error;
 }
 



Home | Main Index | Thread Index | Old Index