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.
*/
/* forthload.c */
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);
/* linux_load.c */
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);
/* boot.c */
extern struct sys_info sys_info;
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
* 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_limit = GDT_LIMIT,
.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) {
printk("calloc overflow: %u, %u\n", nmemb, size);
return 0;
return NULL;
}
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 image_retval;
image_name = image_version = 0;
image_name = image_version = NULL;
if (!file_open(filename))
goto out;

View File

@@ -157,7 +157,7 @@ struct linux_params {
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 */
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 k_len;
int to_kern;
char *initrd = 0;
char *initrd = NULL;
int toolong = 0;
forced_memsize = 0;
if (!orig_cmdline) {
*kern_cmdline = 0;
return 0;
return NULL;
}
k_len = 0;
@@ -328,7 +328,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
val = sep + 1;
len = end - val;
} else {
val = 0;
val = NULL;
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_params *params;
uint32_t kern_addr, kern_size;
char *initrd_file = 0;
char *initrd_file = NULL;
if (!file_open(file))
return -1;

View File

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