Source-Changes-HG archive

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

[src/prg-localcount2]: src/sys/kern Allow the argument to {b, c}devsw_release(...



details:   https://anonhg.NetBSD.org/src/rev/f18820f9179d
branches:  prg-localcount2
changeset: 823555:f18820f9179d
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed May 17 04:33:03 2017 +0000

description:
Allow the argument to {b,c}devsw_release() to be NULL, and treat it as
a No-Op

diffstat:

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

diffs (38 lines):

diff -r 9298335012e2 -r f18820f9179d sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c     Wed May 17 04:29:46 2017 +0000
+++ b/sys/kern/subr_devsw.c     Wed May 17 04:33:03 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_devsw.c,v 1.37.2.3 2017/04/28 03:41:26 pgoyette Exp $     */
+/*     $NetBSD: subr_devsw.c,v 1.37.2.4 2017/05/17 04:33:03 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.37.2.3 2017/04/28 03:41:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.37.2.4 2017/05/17 04:33:03 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -505,8 +505,7 @@
 bdevsw_release(const struct bdevsw *bd)
 {
 
-       KASSERT(bd != NULL);
-       if (bd->d_localcount != NULL)
+       if (bd != NULL && bd->d_localcount != NULL)
                localcount_release(bd->d_localcount, &device_cv, &device_lock);
 }
 
@@ -569,8 +568,7 @@
 cdevsw_release(const struct cdevsw *cd)
 {
 
-       KASSERT(cd != NULL);
-       if (cd->d_localcount != NULL)
+       if (cd != NULL && cd->d_localcount != NULL)
                localcount_release(cd->d_localcount, &device_cv, &device_lock);
 }
 



Home | Main Index | Thread Index | Old Index