summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_autoconf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 49838565ae5..04378697eaa 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.84 2015/01/22 01:19:51 dlg Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.85 2015/02/09 12:37:18 dlg Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -922,7 +922,7 @@ device_mpath(void)
void
device_ref(struct device *dv)
{
- dv->dv_ref++;
+ atomic_inc_int(&dv->dv_ref);
}
/*
@@ -937,8 +937,7 @@ device_unref(struct device *dv)
{
struct cfattach *ca;
- dv->dv_ref--;
- if (dv->dv_ref == 0) {
+ if (atomic_dec_int_nv(&dv->dv_ref) == 0) {
ca = dv->dv_cfdata->cf_attach;
free(dv, M_DEVBUF, ca->ca_devsize);
}