Source-Changes-HG archive

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

[src/pgoyette-localcount]: src/sys/kern Call localcount_init() before publish...



details:   https://anonhg.NetBSD.org/src/rev/8e56d9b4d49e
branches:  pgoyette-localcount
changeset: 852904:8e56d9b4d49e
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Apr 25 21:31:33 2017 +0000

description:
Call localcount_init() before publishing the new {b,c}devsw.

Thanks to riastradh@

diffstat:

 sys/kern/subr_devsw.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r 3605a689f18e -r 8e56d9b4d49e sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c     Tue Apr 25 09:03:03 2017 +0000
+++ b/sys/kern/subr_devsw.c     Tue Apr 25 21:31:33 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_devsw.c,v 1.34.2.14 2017/01/07 08:56:49 pgoyette Exp $    */
+/*     $NetBSD: subr_devsw.c,v 1.34.2.15 2017/04/25 21:31:33 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.14 2017/01/07 08:56:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.15 2017/04/25 21:31:33 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -300,13 +300,14 @@
        if (bdevsw[*devmajor] != NULL)
                return (EEXIST);
 
+       KASSERTMSG(devsw->d_localcount != NULL, "%s: bdev for major %d has "
+           "no localcount", __func__, *devmajor);
+       localcount_init(devsw->d_localcount);
+
        /* ensure visibility of the bdevsw */
        membar_producer();
 
        bdevsw[*devmajor] = devsw;
-       KASSERTMSG(devsw->d_localcount != NULL, "%s: bdev for major %d has "
-           "no localcount", __func__, *devmajor);
-       localcount_init(devsw->d_localcount);
 
        return (0);
 }
@@ -353,13 +354,14 @@
        if (cdevsw[*devmajor] != NULL)
                return (EEXIST);
 
+       KASSERTMSG(devsw->d_localcount != NULL, "%s: cdev for major %d has "
+           "no localcount", __func__, *devmajor);
+       localcount_init(devsw->d_localcount);
+
        /* ensure visibility of the cdevsw */
        membar_producer();
 
        cdevsw[*devmajor] = devsw;
-       KASSERTMSG(devsw->d_localcount != NULL, "%s: cdev for major %d has "
-           "no localcount", __func__, *devmajor);
-       localcount_init(devsw->d_localcount);
 
        return (0);
 }



Home | Main Index | Thread Index | Old Index