From owner-svn-src-all@FreeBSD.ORG Sat May 1 00:36:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D1F1106566C; Sat, 1 May 2010 00:36:41 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0D1178FC0C; Sat, 1 May 2010 00:36:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o410aekL026382; Sat, 1 May 2010 00:36:40 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o410aeGj026381; Sat, 1 May 2010 00:36:40 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201005010036.o410aeGj026381@svn.freebsd.org> From: Jung-uk Kim Date: Sat, 1 May 2010 00:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207454 - head/sys/compat/x86bios X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 May 2010 00:36:41 -0000 Author: jkim Date: Sat May 1 00:36:40 2010 New Revision: 207454 URL: http://svn.freebsd.org/changeset/base/207454 Log: Do not initialize mutex and return error if it cannot map memory. Modified: head/sys/compat/x86bios/x86bios.c Modified: head/sys/compat/x86bios/x86bios.c ============================================================================== --- head/sys/compat/x86bios/x86bios.c Fri Apr 30 22:33:49 2010 (r207453) +++ head/sys/compat/x86bios/x86bios.c Sat May 1 00:36:40 2010 (r207454) @@ -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, 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 = {