From 35845a2acb869ea028c98c8c2b912ae3c61053e2 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 20 Mar 2008 20:05:22 +0000 Subject: [PATCH] Smaller fixes to allow using -Wall (trivial). Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3181 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/coreinfo/Makefile | 2 +- payloads/coreinfo/coreboot_module.c | 10 ++++++---- payloads/coreinfo/coreinfo.c | 6 ++++-- payloads/coreinfo/cpuinfo_module.c | 15 ++++++++++----- payloads/coreinfo/pci_module.c | 8 ++------ 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile index e37dfa3cc9..5b3852b877 100644 --- a/payloads/coreinfo/Makefile +++ b/payloads/coreinfo/Makefile @@ -25,7 +25,7 @@ INCLUDES += -I$(shell $(CC) $(CROSS_CFLAGS) -print-search-dirs | head -n 1 | cut LIBPAYLOAD = ../libpayload/libpayload.a LIBGCC := $(shell $(CC) $(CROSS_CFLAGS) -print-libgcc-file-name) -CFLAGS := -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES) +CFLAGS := -Wall -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES) MODULES = cpuinfo_module.o cpuid.o pci_module.o coreboot_module.o OBJECTS = coreinfo.o diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c index 906833eab3..429d1235f5 100644 --- a/payloads/coreinfo/coreboot_module.c +++ b/payloads/coreinfo/coreboot_module.c @@ -114,6 +114,8 @@ int coreboot_module_redraw(WINDOW *win) UNPACK_CB64(cb_info.range[i].start) + UNPACK_CB64(cb_info.range[i].size) - 1); } + + return 0; } static void parse_memory(unsigned char *ptr) @@ -139,8 +141,8 @@ static void parse_mainboard(unsigned char *ptr) { struct cb_mainboard *mb = (struct cb_mainboard *)ptr; - strncpy(cb_info.vendor, MB_VENDOR_STRING(mb), 31); - strncpy(cb_info.part, MB_PART_STRING(mb), 31); + strncpy(cb_info.vendor, (const char *)MB_VENDOR_STRING(mb), 31); + strncpy(cb_info.part, (const char *)MB_PART_STRING(mb), 31); } static void parse_strings(unsigned char *ptr) @@ -148,7 +150,7 @@ static void parse_strings(unsigned char *ptr) struct cb_string *string = (struct cb_string *)ptr; int index = string->tag - CB_TAG_VERSION; - strncpy(cb_info.strings[index], string->string, 63); + strncpy(cb_info.strings[index], (const char *)string->string, 63); cb_info.strings[index][63] = 0; } @@ -173,7 +175,7 @@ static int parse_header(void *addr, int len) for (i = 0; i < len; i += 16, ptr += 16) { header = (struct cb_header *)ptr; - if (!strncmp(header->signature, "LBIO", 4)) + if (!strncmp((const char *)header->signature, "LBIO", 4)) break; } diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c index 4a86bc256f..de183886ca 100644 --- a/payloads/coreinfo/coreinfo.c +++ b/payloads/coreinfo/coreinfo.c @@ -52,7 +52,7 @@ void print_module_title(WINDOW *win, const char *title) void print_menu(void) { - int i, j, len; + int i, j; char menu[80]; char *ptr = menu; @@ -105,7 +105,7 @@ static void redraw_module(void) refresh(); } -int loop(void) +void loop(void) { int key; @@ -168,4 +168,6 @@ int main(void) modules[i]->init(); loop(); + + return 0; } diff --git a/payloads/coreinfo/cpuinfo_module.c b/payloads/coreinfo/cpuinfo_module.c index 1921526a4a..3dd97f891d 100644 --- a/payloads/coreinfo/cpuinfo_module.c +++ b/payloads/coreinfo/cpuinfo_module.c @@ -92,7 +92,6 @@ static unsigned int cpu_khz; void decode_flags(WINDOW *win, unsigned long reg, const char **flags, int *row) { - int index = 0; int i; int lrow = *row; @@ -117,7 +116,6 @@ void decode_flags(WINDOW *win, unsigned long reg, const char **flags, int *row) static void get_features(WINDOW *win, int *row) { unsigned long eax, ebx, ecx, edx; - int index = 0; int lrow = *row; wmove(win, lrow++, 1); @@ -152,7 +150,7 @@ static void get_features(WINDOW *win, int *row) static void do_name(WINDOW *win, int row) { - char str[80], name[49], *p; + char name[49], *p; unsigned long eax, ebx, ecx, edx; int i, t; @@ -177,11 +175,11 @@ static void do_name(WINDOW *win, int row) mvwprintw(win, row, 1, "Processor: %s", name); } -int cpuinfo_module_redraw(WINDOW * win) +int cpuinfo_module_redraw(WINDOW *win) { unsigned long eax, ebx, ecx, edx; unsigned int brand; - char str[80], *vstr; + char *vstr; int row = 2; print_module_title(win, "CPU Information"); @@ -210,6 +208,10 @@ int cpuinfo_module_redraw(WINDOW * win) break; case VENDOR_SIS: vstr = "SiS"; + break; + default: + vstr = "Unknown"; + break; } mvwprintw(win, row++, 1, "Vendor: %s", vstr); @@ -238,6 +240,8 @@ int cpuinfo_module_redraw(WINDOW * win) row++; get_features(win, &row); + + return 0; } unsigned int getticks(void) @@ -255,6 +259,7 @@ unsigned int getticks(void) int cpuinfo_module_init(void) { cpu_khz = getticks(); + return 0; } struct coreinfo_module cpuinfo_module = { diff --git a/payloads/coreinfo/pci_module.c b/payloads/coreinfo/pci_module.c index af6a23eaaa..59e414a417 100644 --- a/payloads/coreinfo/pci_module.c +++ b/payloads/coreinfo/pci_module.c @@ -106,7 +106,7 @@ static void pci_read_byte(unsigned int bus, unsigned int devfn, *val = inb(0xcfc + (reg & 3)); } -static int show_config_space(WINDOW *win, int row, int col, int index) +static void show_config_space(WINDOW *win, int row, int col, int index) { unsigned char cspace[64]; int bus, devfn; @@ -116,7 +116,7 @@ static int show_config_space(WINDOW *win, int row, int col, int index) devfn = devices[index].device & 0xff; for (i = 0; i < 64; i += 4) - pci_read_dword(bus, devfn, i, ((int *)&cspace[i])); + pci_read_dword(bus, devfn, i, ((unsigned int *)&cspace[i])); for (y = 0; y < 4; y++) { for (x = 0; x < 16; x++) @@ -272,11 +272,7 @@ int pci_module_handle(int key) int pci_module_init(void) { - unsigned int val; - int bus = 0; - pci_scan_bus(0); - return 0; }