Mathias Krause (mathias.krause@secunet.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/747
-gerrit
commit fd0f87b5695eeb3ec120dcdbb9409473582c4949 Author: Mathias Krause mathias.krause@secunet.com Date: Tue Mar 6 16:10:27 2012 +0100
Fix some compiler warnings
The makefile cleanup brought up quite a few compiler warnings about unused functions and/or variables, undefined behaviour, missing return values and type mismatches. Fix those.
Change-Id: I0e01b5fafd9d7594ec41c01d849f6ef9a2d56299 Signed-off-by: Mathias Krause mathias.krause@secunet.com --- drivers/flash/lxflash.c | 14 ++------------ fs/blockdev.c | 14 +++++++------- fs/fsys_cramfs.c | 6 +++--- fs/fsys_ext2fs.c | 5 ++--- fs/fsys_xfs.c | 2 +- fs/mini_inflate.c | 5 ++++- i386/wince_load.c | 2 +- include/fs.h | 2 +- main/grub/builtins.c | 6 +++--- main/grub/completions.c | 2 +- main/grub/grub.c | 2 ++ 11 files changed, 27 insertions(+), 33 deletions(-)
diff --git a/drivers/flash/lxflash.c b/drivers/flash/lxflash.c index ba76741..df18c8d 100644 --- a/drivers/flash/lxflash.c +++ b/drivers/flash/lxflash.c @@ -345,16 +345,6 @@ static __inline void NAND_writeByte(u8 b) outb(b, g_baseAddr + IO_NAND_DATA); }
-static void NAND_writeData(u8 *pData, int nSize) -{ - int i; - if(nSize > 528) return; // oversized buffer? - - // write byte by byte, pedestrian way - for(i=0; i<nSize; i++) - NAND_writeByte(pData[i]); -} - //////////////////////////////////////////////////////////////////////////////// // // NAND_getStatus() @@ -521,7 +511,7 @@ __inline int IsECCWritten(u8 *pECC) //////////////////////////////////////////////////////////////////////////////// //
-int NAND_close(void) +void NAND_close(void) { if (g_chipID >= 0) wrmsr(MSR_DIVIL_LBAR_FLSH0 + g_chipID, g_orig_flsh); @@ -650,7 +640,7 @@ int NAND_readPage(u32 pageAddr, u8 *pPageBuff) // sanity check if (pageAddr < (g_flashInfo.numBlocks * g_flashInfo.pagesPerBlock)) { - u8 bData = 0, bBadBlock = 0, bReserved = 0; + u8 bBadBlock = 0, bReserved = 0;
u8 addr1 = (u8)(pageAddr & 0xff); u8 addr2 = (u8)((pageAddr >> 8) & 0xff); diff --git a/fs/blockdev.c b/fs/blockdev.c index 21d2c29..e1e9d57 100644 --- a/fs/blockdev.c +++ b/fs/blockdev.c @@ -385,8 +385,10 @@ static void *read_sector(unsigned long sector) int count = (NUM_CACHE-hash>8)?8:(NUM_CACHE-hash); int ret; ret = ide_read_blocks(dev_drive, sector, count, buf); - if (ret == 2) - goto nomedium; + if (ret == 2) { + printf("No disk in drive.\n"); + goto err_out; + } if (ret != 0) goto readerr; while (--count>0) { @@ -426,11 +428,9 @@ static void *read_sector(unsigned long sector) readerr: printf("Disk read error dev=%d drive=%d sector=%lu\n", dev_type, dev_drive, sector); - flush_cache(); - dev_name[0] = '\0'; /* force re-open the device next time */ - return 0; - nomedium: - printf("No disk in drive.\n"); +#ifdef CONFIG_IDE_NEW_DISK + err_out: +#endif flush_cache(); dev_name[0] = '\0'; /* force re-open the device next time */ return 0; diff --git a/fs/fsys_cramfs.c b/fs/fsys_cramfs.c index c5a9247..d7cb19b 100644 --- a/fs/fsys_cramfs.c +++ b/fs/fsys_cramfs.c @@ -103,8 +103,8 @@ struct cramfs_buf { struct cramfs_inode inode; char name[NAMELEN_MAX + 1]; u32 block_ptrs[CRAMFS_MAX_BLOCKS]; - char data[CRAMFS_BLOCK * 2]; - char temp[CRAMFS_BLOCK]; + unsigned char data[CRAMFS_BLOCK * 2]; + unsigned char temp[CRAMFS_BLOCK]; /* menu.lst is read 1 byte at a time, try to aleviate * * the performance problem */ long cached_block; /* the uncompressed block in cramfs_buf->data */ @@ -246,7 +246,7 @@ cramfs_read (char *buf, int len) memcpy(buf, cramfs_buf->temp + (filepos % CRAMFS_BLOCK), size); } else { /* just another full block read */ - size = decompress_block(buf, cramfs_buf->data + 2, memcpy); + size = decompress_block((unsigned char *)buf, cramfs_buf->data + 2, memcpy); } if (size < 0) { debug_cramfs("error in decomp (error %d)\n", size); diff --git a/fs/fsys_ext2fs.c b/fs/fsys_ext2fs.c index 30a78ec..96e2e68 100644 --- a/fs/fsys_ext2fs.c +++ b/fs/fsys_ext2fs.c @@ -631,10 +631,9 @@ static int ext4fs_block_map (int logical_block) { struct ext4_extent_header *eh; - struct ext4_extent *ex, *extent; - struct ext4_extent_idx *ei, *index; + struct ext4_extent_idx *ei; + struct ext4_extent *ex; int depth; - int i;
#ifdef E2DEBUG unsigned char *i; diff --git a/fs/fsys_xfs.c b/fs/fsys_xfs.c index 4011479..c71af98 100644 --- a/fs/fsys_xfs.c +++ b/fs/fsys_xfs.c @@ -365,7 +365,7 @@ next_dentry (xfs_ino_t *ino) default: namelen = sfe->namelen; *ino = sf_ino ((char *)sfe, namelen); - name = sfe->name; + name = (char *) sfe->name; sfe = (xfs_dir2_sf_entry_t *) ((char *)sfe + namelen + 11 - xfs.i8param); } diff --git a/fs/mini_inflate.c b/fs/mini_inflate.c index 17e3390..eae371d 100644 --- a/fs/mini_inflate.c +++ b/fs/mini_inflate.c @@ -185,7 +185,10 @@ static void decompress_huffman(struct bitstream *stream, unsigned char *dest) dist += (symbol % 2) << ((symbol - 2) >> 1); } stream->decoded += length; - for (i = 0; i < length; i++) *(dest++) = dest[-dist]; + for (i = 0; i < length; i++) { + *dest = dest[-dist]; + dest++; + } } } while (symbol != 256); /* 256 is the end of the data block */ } diff --git a/i386/wince_load.c b/i386/wince_load.c index f3e5475..993815f 100644 --- a/i386/wince_load.c +++ b/i386/wince_load.c @@ -240,7 +240,7 @@ void wince_init_bootarg(u32 entryPoint) g_pBootArgs->dwEdbgBaseAddr = 0;
// set the KITL device name to something adequate - strcpy(g_pBootArgs->szDeviceNameRoot, "FILO"); + strcpy((char *) g_pBootArgs->szDeviceNameRoot, "FILO");
g_pBootArgs->dwSig = BOOTARG_SIGNATURE; g_pBootArgs->dwLen = sizeof(BOOT_ARGS); diff --git a/include/fs.h b/include/fs.h index 1bd8ec7..3138ab5 100644 --- a/include/fs.h +++ b/include/fs.h @@ -46,7 +46,7 @@ int usb_read(const int drive, const sector_t sector, const int size, void *buffe #ifdef CONFIG_FLASH_DISK int flash_probe(int drive); int flash_read(int drive, sector_t sector, void *buffer); -int NAND_close(void); +void NAND_close(void); #endif
#define DISK_IDE 1 diff --git a/main/grub/builtins.c b/main/grub/builtins.c index e2f4612..3451071 100644 --- a/main/grub/builtins.c +++ b/main/grub/builtins.c @@ -379,9 +379,9 @@ static int dumpmem_func(char *arg, int flags) }
// FIXME - if (!safe_parse_maxint(&string_argv[1], &mem_base)) + if (!safe_parse_maxint(&string_argv[1], (int *)&mem_base)) return 1; - if (!safe_parse_maxint(&string_argv[2], &mem_len)) + if (!safe_parse_maxint(&string_argv[2], (int *)&mem_len)) return 1;
grub_printf("Dumping memory at 0x%08x (0x%x bytes)\n", @@ -668,7 +668,7 @@ void copy_path_to_filo_bootline(char *arg, char *path, int use_rootdev, int appe char drivername[16]; int disk, part; unsigned long addr; - int i, len; + int i;
memset(devicename, 0, 16); memset(drivername, 0, 16); diff --git a/main/grub/completions.c b/main/grub/completions.c index a3aeba2..abfe1d9 100644 --- a/main/grub/completions.c +++ b/main/grub/completions.c @@ -120,7 +120,7 @@ int print_completions(int is_filename, int is_completion) if (*buf == '(' && (incomplete || ! *ptr)) { if (!part_choice) { /* disk completions */ - int disk_no, i, j; + int i, j;
if (!is_completion) grub_printf (" Possible disks are: "); diff --git a/main/grub/grub.c b/main/grub/grub.c index b4bee04..b629435 100644 --- a/main/grub/grub.c +++ b/main/grub/grub.c @@ -201,6 +201,7 @@ old:
}
+#ifdef CONFIG_NON_INTERACTIVE static void reboot(void) { for (;;) { grub_printf("Press any key to reboot.\n"); @@ -210,6 +211,7 @@ static void reboot(void) { } } } +#endif
/* Define if there is user specified preset menu string */ /* #undef PRESET_MENU_STRING */