diff options
author | jkim <jkim@FreeBSD.org> | 2010-05-01 00:36:40 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2010-05-01 00:36:40 +0000 |
commit | b092dfff5962d508bdc6f177675864d37c1e48ff (patch) | |
tree | 98887d904d03968cd49b1a5529e54db078f3ebfb /sys/compat/x86bios | |
parent | 83a9d5d7455091b609ad7183f2a3f9216d8982e0 (diff) | |
download | FreeBSD-src-b092dfff5962d508bdc6f177675864d37c1e48ff.zip FreeBSD-src-b092dfff5962d508bdc6f177675864d37c1e48ff.tar.gz |
Do not initialize mutex and return error if it cannot map memory.
Diffstat (limited to 'sys/compat/x86bios')
-rw-r--r-- | sys/compat/x86bios/x86bios.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/compat/x86bios/x86bios.c b/sys/compat/x86bios/x86bios.c index d5512fc..defdbca 100644 --- a/sys/compat/x86bios/x86bios.c +++ b/sys/compat/x86bios/x86bios.c @@ -563,15 +563,15 @@ x86bios_unmap_mem(void) contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF); } -static void -x86bios_init(void *arg __unused) +static int +x86bios_init(void) { int i; - mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN); - if (x86bios_map_mem() != 0) - return; + return (ENOMEM); + + mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN); x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF, M_WAITOK | M_ZERO); @@ -600,10 +600,12 @@ x86bios_init(void *arg __unused) for (i = 0; i < 256; i++) x86bios_emu._x86emu_intrTab[i] = x86bios_emu_get_intr; + + return (0); } -static void -x86bios_uninit(void *arg __unused) +static int +x86bios_uninit(void) { vm_offset_t *map = x86bios_map; @@ -618,6 +620,8 @@ x86bios_uninit(void *arg __unused) x86bios_unmap_mem(); mtx_destroy(&x86bios_lock); + + return (0); } static int @@ -626,16 +630,12 @@ x86bios_modevent(module_t mod __unused, int type, void *data __unused) switch (type) { case MOD_LOAD: - x86bios_init(NULL); - break; + return (x86bios_init()); case MOD_UNLOAD: - x86bios_uninit(NULL); - break; + return (x86bios_uninit()); default: return (ENOTSUP); } - - return (0); } static moduledata_t x86bios_mod = { |