[Midnightbsd-cvs] src [8054] trunk/sys/kern/subr_firmware.c: do not increment the parent firmware reference count when any other image is registered
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Sep 15 17:26:18 EDT 2016
Revision: 8054
http://svnweb.midnightbsd.org/src/?rev=8054
Author: laffer1
Date: 2016-09-15 17:26:18 -0400 (Thu, 15 Sep 2016)
Log Message:
-----------
do not increment the parent firmware reference count when any other image is registered
Modified Paths:
--------------
trunk/sys/kern/subr_firmware.c
Modified: trunk/sys/kern/subr_firmware.c
===================================================================
--- trunk/sys/kern/subr_firmware.c 2016-09-15 21:24:18 UTC (rev 8053)
+++ trunk/sys/kern/subr_firmware.c 2016-09-15 21:26:18 UTC (rev 8054)
@@ -198,10 +198,8 @@
frp->fw.data = data;
frp->fw.datasize = datasize;
frp->fw.version = version;
- if (parent != NULL) {
+ if (parent != NULL)
frp->parent = PRIV_FW(parent);
- frp->parent->refcnt++;
- }
mtx_unlock(&firmware_mtx);
if (bootverbose)
printf("firmware: '%s' version %u: %zu bytes loaded at %p\n",
@@ -235,8 +233,6 @@
} else {
linker_file_t x = fp->file; /* save value */
- if (fp->parent != NULL) /* release parent reference */
- fp->parent->refcnt--;
/*
* Clear the whole entry with bzero to make sure we
* do not forget anything. Then restore 'file' which is
@@ -341,6 +337,8 @@
return NULL;
}
found: /* common exit point on success */
+ if (fp->refcnt == 0 && fp->parent != NULL)
+ fp->parent->refcnt++;
fp->refcnt++;
mtx_unlock(&firmware_mtx);
return &fp->fw;
@@ -363,6 +361,8 @@
mtx_lock(&firmware_mtx);
fp->refcnt--;
if (fp->refcnt == 0) {
+ if (fp->parent != NULL)
+ fp->parent->refcnt--;
if (flags & FIRMWARE_UNLOAD)
fp->flags |= FW_UNLOAD;
if (fp->file)
More information about the Midnightbsd-cvs
mailing list