Eliminate various issues brought up by scan-build.
authorPatrick Georgi <patrick.georgi@coresystems.de>
Tue, 21 Apr 2009 20:14:31 +0000 (20:14 +0000)
committerPatrick Georgi <patrick.georgi@coresystems.de>
Tue, 21 Apr 2009 20:14:31 +0000 (20:14 +0000)
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

src/arch/i386/boot/coreboot_table.c
src/boot/elfboot.c
src/console/usbdebug_direct_console.c
src/devices/pci_device.c
src/devices/pci_rom.c
src/include/console/console.h
util/buildrom/buildrom.c
util/nrv2b/nrv2b.c

index aa665c25205042adb5527ef899aa014f12204980..88605cd0d1c17f36d7c4ce36596e8b7a70510f57 100644 (file)
@@ -93,9 +93,8 @@ struct lb_serial *lb_serial(struct lb_header *header)
 
 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);
index ed15e96fe7b1a3c8de622e98cb24770f89fd079d..acffb634dac94e643f3989bb9e57e9cd3037eacb 100644 (file)
@@ -362,9 +362,6 @@ static void relocate_segment(unsigned long buffer, struct segment *seg)
                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,
index 18fe6dcb374d8b509475db3454a057e2477116f3..86b89bd920496f97063f86815ce5d80e7c95fc04 100644 (file)
@@ -1,3 +1,4 @@
+#include <string.h>
 #include <console/console.h>
 #include <usbdebug_direct.h>
 #include <pc80/mc146818rtc.h>
index 0e7a5df48740a127fb3da7d8a2f748cc839d6faa..c816ae0b2c0dcc56988fb0ee980ab6569555327c 100644 (file)
@@ -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 @@ static void pci_get_rom_resource(struct device *dev, unsigned long index)
 {
        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 @@ static void pci_get_rom_resource(struct device *dev, unsigned long index)
         * - 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 @@ static void pci_get_rom_resource(struct device *dev, unsigned long index)
                        resource->align += 1;
                        resource->gran  += 1;
                }
-               resource->limit = limit = moving | (resource->size - 1);
+               resource->limit = moving | (resource->size - 1);
        }
 
        if (moving == 0) {
index 5df13a421432b715919320a30a762bf29cf17a90..e628161cf6e672ea86631870ef916320f49ab08e 100644 (file)
@@ -42,7 +42,7 @@ struct rom_header * pci_rom_probe(struct device *dev)
                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;
                }
        } 
index 3e1607b2a7c7657da4b7585621d01edb101bdb55..cea174c34e78c2424665c3bf6737e2ab6799a750 100644 (file)
@@ -10,7 +10,7 @@ void console_tx_flush(void);
 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);
index 385b707e53f2d2d94cbca988ec40292a95d5e5a4..f3efc96b3ee70e04154742bea34fc986bd9f270a 100644 (file)
@@ -24,7 +24,7 @@ void usage()
        exit(1);
 }
 
-void fatal(char *s)
+void __attribute__((noreturn)) fatal(char *s)
 {
        perror(s);
        exit(2);
index b9e1c106480bb007a0af5c7e90825cf079da5b38..e341a7b61de8839f83fd82b1eb539fd17cd3ce6f 100644 (file)
@@ -65,7 +65,7 @@ FILE  *infile, *outfile;
 #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);