From e633976ebd7bedf365e4bdd9da1660b40c743a2b Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 28 Oct 2003 18:21:49 +0000 Subject: [PATCH] Elminate GCC uninitialized variable warning. --- sys/dev/mvme/mvmebus.c | 29 +++++++---------------------- sys/dev/vme/vmereg.h | 3 ++- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/sys/dev/mvme/mvmebus.c b/sys/dev/mvme/mvmebus.c index 21f328fd5239..c8d28bdbc87d 100644 --- a/sys/dev/mvme/mvmebus.c +++ b/sys/dev/mvme/mvmebus.c @@ -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 -__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 #include @@ -915,28 +915,13 @@ mvmebus_mod_string(addr, len, am, ds) 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 --git a/sys/dev/vme/vmereg.h b/sys/dev/vme/vmereg.h index 8208f5b74a4b..6e22df70baff 100644 --- a/sys/dev/vme/vmereg.h +++ b/sys/dev/vme/vmereg.h @@ -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