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 if then else the same thing. print a more m...



details:   https://anonhg.NetBSD.org/src/rev/21931929bf15
branches:  trunk
changeset: 769556:21931929bf15
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Sep 14 12:30:20 2011 +0000

description:
- don't if then else the same thing. print a more meaningful message
- don't leak a dictionary on failure
- minor KNF

diffstat:

 sys/kern/kern_module_vfs.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (51 lines):

diff -r dd94945061c9 -r 21931929bf15 sys/kern/kern_module_vfs.c
--- a/sys/kern/kern_module_vfs.c        Wed Sep 14 12:29:22 2011 +0000
+++ b/sys/kern/kern_module_vfs.c        Wed Sep 14 12:30:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module_vfs.c,v 1.11 2011/08/06 08:11:09 mbalmer Exp $     */
+/*     $NetBSD: kern_module_vfs.c,v 1.12 2011/09/14 12:30:20 christos Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.11 2011/08/06 08:11:09 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.12 2011/09/14 12:30:20 christos Exp $");
 
 #define _MODULE_INTERNAL
 #include <sys/param.h>
@@ -95,13 +95,8 @@
        }
        if (error != 0) {
                PNBUF_PUT(path);
-               if (autoload) {
-                       module_print("Cannot load kernel object `%s'"
-                           " error=%d", name, error);
-               } else {
-                       module_error("Cannot load kernel object `%s'"
-                           " error=%d", name, error);
-               }
+               module_print("Cannot %sload kernel object `%s'"
+                   " error=%d", autoload ? "auto" : "", name, error);
                return error;
        }
 
@@ -120,6 +115,7 @@
                        if (noload != NULL && prop_bool_true(noload)) {
                                module_error("autoloading is disallowed for %s",
                                    path);
+                               prop_object_release(moduledict);
                                error = EPERM;
                                goto fail;
                        }
@@ -148,7 +144,7 @@
  */
 static int
 module_load_plist_vfs(const char *modpath, const bool nochroot,
-                      prop_dictionary_t *filedictp)
+    prop_dictionary_t *filedictp)
 {
        struct pathbuf *pb;
        struct nameidata nd;



Home | Main Index | Thread Index | Old Index