ext_ops does not change during the life cycle and can be fetched without trunk
authormlelstv <mlelstv@NetBSD.org>
Wed, 03 Oct 2012 12:24:56 +0000
branchtrunk
changeset 213654 7e40c0f4e3bb
parent 213653 9f2c6de2ed01
child 213655 0451ce3beb43
ext_ops does not change during the life cycle and can be fetched without the mutex held. This avoids confusion in the compiler about an uninitialized variable ext_ops. ok rmind@
sys/net/npf/npf_rproc.c
--- a/sys/net/npf/npf_rproc.c	Wed Oct 03 07:22:59 2012 +0000
+++ b/sys/net/npf/npf_rproc.c	Wed Oct 03 12:24:56 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_rproc.c,v 1.3 2012/09/16 13:47:41 rmind Exp $	*/
+/*	$NetBSD: npf_rproc.c,v 1.4 2012/10/03 12:24:56 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -164,14 +164,16 @@
 	ext = npf_ext_lookup(name);
 	if (ext) {
 		atomic_inc_uint(&ext->ext_refcnt);
-		extops = ext->ext_ops;
-		KASSERT(extops != NULL);
 	}
 	mutex_exit(&ext_lock);
+
 	if (!ext) {
 		return ENOENT;
 	}
 
+	extops = ext->ext_ops;
+	KASSERT(extops != NULL);
+
 	error = extops->ctor(rp, params);
 	if (error) {
 		atomic_dec_uint(&ext->ext_refcnt);