Eliminate various issues brought up by scan-build.
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4152 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/src/arch/i386/boot/coreboot_table.c b/src/arch/i386/boot/coreboot_table.c
index aa665c2..88605cd 100644
--- a/src/arch/i386/boot/coreboot_table.c
+++ b/src/arch/i386/boot/coreboot_table.c
@@ -93,9 +93,8 @@
void add_console(struct lb_header *header, u16 consoletype)
{
- struct lb_record *rec;
struct lb_console *console;
- rec = lb_new_record(header);
+
console = (struct lb_console *)lb_new_record(header);
console->tag = LB_TAG_CONSOLE;
console->size = sizeof(*console);
diff --git a/src/boot/elfboot.c b/src/boot/elfboot.c
index ed15e96..acffb63 100644
--- a/src/boot/elfboot.c
+++ b/src/boot/elfboot.c
@@ -362,9 +362,6 @@
seg->phdr_next->phdr_prev = new;
seg->phdr_next = new;
- /* compute the new value of end */
- end = start + len;
-
printk_spew(" late: [0x%016lx, 0x%016lx, 0x%016lx)\n",
new->s_addr,
new->s_addr + new->s_filesz,
diff --git a/src/console/usbdebug_direct_console.c b/src/console/usbdebug_direct_console.c
index 18fe6dc..86b89bd 100644
--- a/src/console/usbdebug_direct_console.c
+++ b/src/console/usbdebug_direct_console.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include <console/console.h>
#include <usbdebug_direct.h>
#include <pc80/mc146818rtc.h>
diff --git a/src/devices/pci_device.c b/src/devices/pci_device.c
index 0e7a5df..c816ae0 100644
--- a/src/devices/pci_device.c
+++ b/src/devices/pci_device.c
@@ -10,7 +10,8 @@
* Copyright (C) 2004-2005 Li-Ta Lo <ollie@lanl.gov>
* Copyright (C) 2005-2006 Tyan
* (Written by Yinghai Lu <yhlu@tyan.com> for Tyan)
- * Copyright (C) 2005-2007 Stefan Reinauer <stepan@openbios.org>
+ * Copyright (C) 2005-2009 coresystems GmbH
+ * (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
*/
/*
@@ -271,7 +272,7 @@
{
struct resource *resource;
unsigned long value;
- resource_t moving, limit;
+ resource_t moving;
if ((dev->on_mainboard) && (dev->rom_address == 0)) {
//skip it if rom_address is not set in MB Config.lb
@@ -296,8 +297,6 @@
* - Limit is all of the bits that move plus all of the lower bits.
* See PCI Spec 6.2.5.1 ...
*/
- limit = 0;
-
if (moving) {
resource->size = 1;
resource->align = resource->gran = 0;
@@ -306,7 +305,7 @@
resource->align += 1;
resource->gran += 1;
}
- resource->limit = limit = moving | (resource->size - 1);
+ resource->limit = moving | (resource->size - 1);
}
if (moving == 0) {
diff --git a/src/devices/pci_rom.c b/src/devices/pci_rom.c
index 5df13a4..e628161 100644
--- a/src/devices/pci_rom.c
+++ b/src/devices/pci_rom.c
@@ -42,7 +42,7 @@
printk_debug("In cbfs, rom address for %s = %lx\n",
dev_path(dev), rom_address);
if (v) {
- dev->rom_address = v;
+ dev->rom_address = (u32)v;
dev->on_mainboard = 1;
}
}
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 3e1607b..cea174c 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -10,7 +10,7 @@
unsigned char console_rx_byte(void);
int console_tst_byte(void);
void post_code(uint8_t value);
-void die(const char *msg);
+void __attribute__ ((noreturn)) die(const char *msg);
struct console_driver {
void (*init)(void);
diff --git a/util/buildrom/buildrom.c b/util/buildrom/buildrom.c
index 385b707..f3efc96b 100644
--- a/util/buildrom/buildrom.c
+++ b/util/buildrom/buildrom.c
@@ -24,7 +24,7 @@
exit(1);
}
-void fatal(char *s)
+void __attribute__((noreturn)) fatal(char *s)
{
perror(s);
exit(2);
diff --git a/util/nrv2b/nrv2b.c b/util/nrv2b/nrv2b.c
index b9e1c10..e341a7b 100644
--- a/util/nrv2b/nrv2b.c
+++ b/util/nrv2b/nrv2b.c
@@ -65,7 +65,7 @@
#define BITSIZE 32
#endif
-static __inline__ void Error(char *message)
+static __inline__ __attribute__((noreturn)) void Error(char *message)
{
Fprintf((stderr, "\n%s\n", message));
exit(EXIT_FAILURE);