[coreboot] [v2] r4152 - in trunk/coreboot-v2: src/arch/i386/boot src/boot src/console src/devices src/include/console util/buildrom util/nrv2b

svn at coreboot.org svn at coreboot.org
Tue Apr 21 22:14:31 CEST 2009


Author: oxygene
Date: 2009-04-21 22:14:31 +0200 (Tue, 21 Apr 2009)
New Revision: 4152

Modified:
   trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c
   trunk/coreboot-v2/src/boot/elfboot.c
   trunk/coreboot-v2/src/console/usbdebug_direct_console.c
   trunk/coreboot-v2/src/devices/pci_device.c
   trunk/coreboot-v2/src/devices/pci_rom.c
   trunk/coreboot-v2/src/include/console/console.h
   trunk/coreboot-v2/util/buildrom/buildrom.c
   trunk/coreboot-v2/util/nrv2b/nrv2b.c
Log:
Eliminate various issues brought up by scan-build.

Signed-off-by: Patrick Georgi <patrick.georgi at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>



Modified: trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c
===================================================================
--- trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c	2009-04-21 20:14:31 UTC (rev 4152)
@@ -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);

Modified: trunk/coreboot-v2/src/boot/elfboot.c
===================================================================
--- trunk/coreboot-v2/src/boot/elfboot.c	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/src/boot/elfboot.c	2009-04-21 20:14:31 UTC (rev 4152)
@@ -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,

Modified: trunk/coreboot-v2/src/console/usbdebug_direct_console.c
===================================================================
--- trunk/coreboot-v2/src/console/usbdebug_direct_console.c	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/src/console/usbdebug_direct_console.c	2009-04-21 20:14:31 UTC (rev 4152)
@@ -1,3 +1,4 @@
+#include <string.h>
 #include <console/console.h>
 #include <usbdebug_direct.h>
 #include <pc80/mc146818rtc.h>

Modified: trunk/coreboot-v2/src/devices/pci_device.c
===================================================================
--- trunk/coreboot-v2/src/devices/pci_device.c	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/src/devices/pci_device.c	2009-04-21 20:14:31 UTC (rev 4152)
@@ -10,7 +10,8 @@
  * Copyright (C) 2004-2005 Li-Ta Lo <ollie at lanl.gov>
  * Copyright (C) 2005-2006 Tyan
  * (Written by Yinghai Lu <yhlu at tyan.com> for Tyan)
- * Copyright (C) 2005-2007 Stefan Reinauer <stepan at openbios.org>
+ * Copyright (C) 2005-2009 coresystems GmbH
+ * (Written by Stefan Reinauer <stepan at 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) {

Modified: trunk/coreboot-v2/src/devices/pci_rom.c
===================================================================
--- trunk/coreboot-v2/src/devices/pci_rom.c	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/src/devices/pci_rom.c	2009-04-21 20:14:31 UTC (rev 4152)
@@ -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;
 		}
 	} 

Modified: trunk/coreboot-v2/src/include/console/console.h
===================================================================
--- trunk/coreboot-v2/src/include/console/console.h	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/src/include/console/console.h	2009-04-21 20:14:31 UTC (rev 4152)
@@ -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);

Modified: trunk/coreboot-v2/util/buildrom/buildrom.c
===================================================================
--- trunk/coreboot-v2/util/buildrom/buildrom.c	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/util/buildrom/buildrom.c	2009-04-21 20:14:31 UTC (rev 4152)
@@ -24,7 +24,7 @@
 	exit(1);
 }
 
-void fatal(char *s)
+void __attribute__((noreturn)) fatal(char *s)
 {
 	perror(s);
 	exit(2);

Modified: trunk/coreboot-v2/util/nrv2b/nrv2b.c
===================================================================
--- trunk/coreboot-v2/util/nrv2b/nrv2b.c	2009-04-21 12:41:55 UTC (rev 4151)
+++ trunk/coreboot-v2/util/nrv2b/nrv2b.c	2009-04-21 20:14:31 UTC (rev 4152)
@@ -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);





More information about the coreboot mailing list