Fix most x86 warnings from Sparse

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@534 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2009-08-04 20:37:32 +00:00
parent d4b64752eb
commit 2828b56876
5 changed files with 20 additions and 9 deletions

View File

@@ -6,9 +6,19 @@
* the copyright and warranty status of this work. * the copyright and warranty status of this work.
*/ */
/* forthload.c */
int forth_load(struct sys_info *info, const char *filename, const char *cmdline); int forth_load(struct sys_info *info, const char *filename, const char *cmdline);
/* elfload.c */
int elf_load(struct sys_info *info, const char *filename, const char *cmdline); int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
/* linux_load.c */
int linux_load(struct sys_info *info, const char *file, const char *cmdline); int linux_load(struct sys_info *info, const char *file, const char *cmdline);
/* context.c */
extern struct context *__context;
unsigned int start_elf(unsigned long entry_point, unsigned long param); unsigned int start_elf(unsigned long entry_point, unsigned long param);
/* boot.c */
extern struct sys_info sys_info;
void boot(void); void boot(void);

View File

@@ -26,7 +26,7 @@ void __exit_context(void); /* assembly routine */
* It is placed at the bottom of our stack, and loaded by assembly routine * It is placed at the bottom of our stack, and loaded by assembly routine
* to start us up. * to start us up.
*/ */
struct context main_ctx __attribute__((section (".initctx"))) = { static struct context main_ctx __attribute__((section (".initctx"))) = {
.gdt_base = (uint32_t) gdt, .gdt_base = (uint32_t) gdt,
.gdt_limit = GDT_LIMIT, .gdt_limit = GDT_LIMIT,
.cs = FLAT_CS, .cs = FLAT_CS,

View File

@@ -30,7 +30,7 @@ static void *calloc(size_t nmemb, size_t size)
if (alloc_size < nmemb || alloc_size < size) { if (alloc_size < nmemb || alloc_size < size) {
printk("calloc overflow: %u, %u\n", nmemb, size); printk("calloc overflow: %u, %u\n", nmemb, size);
return 0; return NULL;
} }
mem = malloc(alloc_size); mem = malloc(alloc_size);
@@ -314,7 +314,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
int retval = -1; int retval = -1;
int image_retval; int image_retval;
image_name = image_version = 0; image_name = image_version = NULL;
if (!file_open(filename)) if (!file_open(filename))
goto out; goto out;

View File

@@ -157,7 +157,7 @@ struct linux_params {
uint8_t reserved17[1792]; /* 0x900 - 0x1000 */ uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
}; };
uint64_t forced_memsize; static uint64_t forced_memsize;
/* Load the first part the file and check if it's Linux */ /* Load the first part the file and check if it's Linux */
static uint32_t load_linux_header(struct linux_header *hdr) static uint32_t load_linux_header(struct linux_header *hdr)
@@ -294,14 +294,14 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
int len; int len;
int k_len; int k_len;
int to_kern; int to_kern;
char *initrd = 0; char *initrd = NULL;
int toolong = 0; int toolong = 0;
forced_memsize = 0; forced_memsize = 0;
if (!orig_cmdline) { if (!orig_cmdline) {
*kern_cmdline = 0; *kern_cmdline = 0;
return 0; return NULL;
} }
k_len = 0; k_len = 0;
@@ -328,7 +328,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
val = sep + 1; val = sep + 1;
len = end - val; len = end - val;
} else { } else {
val = 0; val = NULL;
len = 0; len = 0;
} }
@@ -610,7 +610,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline)
struct linux_header hdr; struct linux_header hdr;
struct linux_params *params; struct linux_params *params;
uint32_t kern_addr, kern_size; uint32_t kern_addr, kern_size;
char *initrd_file = 0; char *initrd_file = NULL;
if (!file_open(file)) if (!file_open(file))
return -1; return -1;

View File

@@ -14,7 +14,8 @@
struct mbheader { struct mbheader {
unsigned int magic, flags, checksum; unsigned int magic, flags, checksum;
}; };
const struct mbheader multiboot_header
static const struct mbheader multiboot_header
__attribute__((section (".hdr"))) = __attribute__((section (".hdr"))) =
{ {
MULTIBOOT_HEADER_MAGIC, MULTIBOOT_HEADER_MAGIC,