Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 i686_mtrr_init_first: handle the case when ...



details:   https://anonhg.NetBSD.org/src/rev/865bb83ea8c3
branches:  trunk
changeset: 778964:865bb83ea8c3
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sun Apr 22 18:59:41 2012 +0000

description:
i686_mtrr_init_first: handle the case when there are no variable-size MTRR
registers available (i686_mtrr_vcnt == 0).

diffstat:

 sys/arch/x86/x86/mtrr_i686.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 9a7ac6975e89 -r 865bb83ea8c3 sys/arch/x86/x86/mtrr_i686.c
--- a/sys/arch/x86/x86/mtrr_i686.c      Sun Apr 22 16:00:45 2012 +0000
+++ b/sys/arch/x86/x86/mtrr_i686.c      Sun Apr 22 18:59:41 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mtrr_i686.c,v 1.26 2012/04/20 22:23:24 rmind Exp $ */
+/*     $NetBSD: mtrr_i686.c,v 1.27 2012/04/22 18:59:41 rmind Exp $ */
 
 /*-
  * Copyright (c) 2000, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.26 2012/04/20 22:23:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.27 2012/04/22 18:59:41 rmind Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -336,9 +336,11 @@
            kmem_zalloc(MTRR_I686_NFIXED_SOFT * sizeof(struct mtrr), KM_SLEEP);
        KASSERT(mtrr_fixed != NULL);
 
-       mtrr_var =
-           kmem_zalloc(i686_mtrr_vcnt * sizeof(struct mtrr), KM_SLEEP);
-       KASSERT(mtrr_var != NULL);
+       if (i686_mtrr_vcnt) {
+               mtrr_var =
+                   kmem_zalloc(i686_mtrr_vcnt * sizeof(struct mtrr), KM_SLEEP);
+               KASSERT(mtrr_var != NULL);
+       }
 
        mtrr_var_raw = &mtrr_raw[0];
        mtrr_fixed_raw = &mtrr_raw[MTRR_I686_NVAR_MAX * 2];



Home | Main Index | Thread Index | Old Index