Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Elminate GCC uninitialized variable warning.



details:   https://anonhg.NetBSD.org/src/rev/9daa82d0d2ff
branches:  trunk
changeset: 554471:9daa82d0d2ff
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Oct 28 18:21:49 2003 +0000

description:
Elminate GCC uninitialized variable warning.

diffstat:

 sys/dev/mvme/mvmebus.c |  29 +++++++----------------------
 sys/dev/vme/vmereg.h   |   3 ++-
 2 files changed, 9 insertions(+), 23 deletions(-)

diffs (66 lines):

diff -r 29922e25adb7 -r 9daa82d0d2ff sys/dev/mvme/mvmebus.c
--- a/sys/dev/mvme/mvmebus.c    Tue Oct 28 17:58:57 2003 +0000
+++ b/sys/dev/mvme/mvmebus.c    Tue Oct 28 18:21:49 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvmebus.c,v 1.4 2003/07/14 15:47:20 lukem Exp $        */
+/*     $NetBSD: mvmebus.c,v 1.5 2003/10/28 18:21:49 matt Exp $ */
 
 /*-
  * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.4 2003/07/14 15:47:20 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.5 2003/10/28 18:21:49 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -915,28 +915,13 @@
        static const char *mode[] = {"BLT64)", "DATA)", "PROG)", "BLT32)"};
        static const char *dsiz[] = {"(", "(D8,", "(D16,", "(D16-D8,",
        "(D32,", "(D32,D8,", "(D32-D16,", "(D32-D8,"};
+       static const char *adrfmt[] = { "A32:%08x-%08x ", "A16:%04x-%04x ",
+           "A24:%06x-%06x ", "USR:%08x-%08x " };
        static char mstring[40];
-       char *fmt;
-
-       switch (am & VME_AM_ADRSIZEMASK) {
-       case VME_AM_A32:
-               fmt = "A32:%08x-%08x ";
-               break;
 
-       case VME_AM_A24:
-               fmt = "A24:%06x-%06x ";
-               break;
-
-       case VME_AM_A16:
-               fmt = "A16:%04x-%04x ";
-               break;
-
-       case VME_AM_USERDEF:
-               fmt = "USR:%08x-%08x ";
-               break;
-       }
-
-       sprintf(mstring, fmt, addr, addr + len - 1);
+       sprintf(mstring,
+           adrfmt[(am & VME_AM_ADRSIZEMASK) >> VME_AM_ADRSIZESHIFT],
+           addr, addr + len - 1);
        strcat(mstring, dsiz[ds & 0x7]);
 
        if (MVMEBUS_AM_HAS_CAP(am)) {
diff -r 29922e25adb7 -r 9daa82d0d2ff sys/dev/vme/vmereg.h
--- a/sys/dev/vme/vmereg.h      Tue Oct 28 17:58:57 2003 +0000
+++ b/sys/dev/vme/vmereg.h      Tue Oct 28 18:21:49 2003 +0000
@@ -1,8 +1,9 @@
-/* $NetBSD: vmereg.h,v 1.1 1999/06/30 15:06:05 drochner Exp $ */
+/* $NetBSD: vmereg.h,v 1.2 2003/10/28 18:21:49 matt Exp $ */
 
 /* constants for address modifiers */
 
 #define VME_AM_ADRSIZEMASK 0x30
+#define VME_AM_ADRSIZESHIFT 4
 #define VME_AM_A32 0
 #define VME_AM_A16 0x20
 #define VME_AM_A24 0x30



Home | Main Index | Thread Index | Old Index