Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sysmon Optimize a bit - don't re-enter the mutex if ...



details:   https://anonhg.NetBSD.org/src/rev/12dc09b86249
branches:  trunk
changeset: 808114:12dc09b86249
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue May 05 09:22:33 2015 +0000

description:
Optimize a bit - don't re-enter the mutex if we're just going to exit.

While here, remove some parens around a return value.

diffstat:

 sys/dev/sysmon/sysmon.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 4b427ffb592f -r 12dc09b86249 sys/dev/sysmon/sysmon.c
--- a/sys/dev/sysmon/sysmon.c   Tue May 05 08:52:51 2015 +0000
+++ b/sys/dev/sysmon/sysmon.c   Tue May 05 09:22:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon.c,v 1.27 2015/05/05 00:28:25 pgoyette Exp $     */
+/*     $NetBSD: sysmon.c,v 1.28 2015/05/05 09:22:33 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon.c,v 1.27 2015/05/05 00:28:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon.c,v 1.28 2015/05/05 09:22:33 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -152,9 +152,9 @@
                        mutex_exit(&sysmon_minor_mtx);
                        error = module_autoload(sysmon_mod[minor(dev)],
                                                MODULE_CLASS_MISC);
+                       if (error)
+                               return error;
                        mutex_enter(&sysmon_minor_mtx);
-                       if (error)
-                               break;
                        if (sysmon_opvec_table[minor(dev)] == NULL) {
                                error = ENODEV;
                                break;
@@ -170,7 +170,7 @@
        }
 
        mutex_exit(&sysmon_minor_mtx);
-       return (error);
+       return error;
 }
 
 /*



Home | Main Index | Thread Index | Old Index