diff mbox

[1/2] Fix warnings generated when compiling with DEBUG=1

Message ID 20080916002316.21352.72659.sendpatchset@chandra-ubuntu
State Superseded
Headers show

Commit Message

Chandra Seetharaman Sept. 16, 2008, 12:23 a.m. UTC
Compiling yaboot with DEBUG=1 generates lot of warnings.

This patch fixes most of those.

Left couple of warnings as they would require close scrutiny.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
 include/ext2fs/bitops.h |    3 ++-
 include/linux/types.h   |    2 +-
 include/setjmp.h        |    2 +-
 second/cfg.c            |    2 +-
 second/fs_ext2.c        |    2 +-
 second/fs_reiserfs.c    |    4 ++--
 second/fs_xfs.c         |    2 +-
 second/partition.c      |    2 +-
 second/yaboot.c         |    6 +++---
 9 files changed, 13 insertions(+), 12 deletions(-)

Comments

Przemyslaw Iskra Sept. 16, 2008, 2:03 p.m. UTC | #1
On Mon, Sep 15, 2008 at 05:23:16PM -0700, Chandra Seetharaman wrote:

> --- yaboot.git_head.orig/second/partition.c
> +++ yaboot.git_head/second/partition.c
> @@ -61,7 +61,7 @@ static const char *valid_mac_partition_t
>  
>  
>  #define MAX_BLOCK_SIZE	2048
> -static unsigned char block_buffer[MAX_BLOCK_SIZE];
> +static char block_buffer[MAX_BLOCK_SIZE];
> 

I don't think that's a good change. block_buffer contains binary data
and may contain values outside 0-127 scope, that's why it should be
explicitly marked as signed or unsigned. I guess unsigned is better in
this case.
diff mbox

Patch

Index: yaboot.git_head/include/linux/types.h
===================================================================
--- yaboot.git_head.orig/include/linux/types.h
+++ yaboot.git_head/include/linux/types.h
@@ -1 +1 @@ 
-#include "../types.h"
\ No newline at end of file
+#include "../types.h"
Index: yaboot.git_head/second/yaboot.c
===================================================================
--- yaboot.git_head.orig/second/yaboot.c
+++ yaboot.git_head/second/yaboot.c
@@ -1000,7 +1000,7 @@  int get_params(struct boot_param_t* para
 
            /* check if user seted to use a initrd file from boot console */
            if (!definitrd && p != manualinitrd) {
-               if (manualinitrd[0] != "/" && (prom_get_devtype(defdevice_bak) != FILE_DEVICE_NET)) {
+               if (manualinitrd[0] != '/' && (prom_get_devtype(defdevice_bak) != FILE_DEVICE_NET)) {
                    strcpy(initrdpath, "/");
                    strcat(initrdpath, manualinitrd);
                } else
@@ -1309,7 +1309,7 @@  load_elf32(struct boot_file_t *file, loa
 {
      int			i;
      Elf32_Ehdr		*e = &(loadinfo->elf.elf32hdr);
-     Elf32_Phdr		*p, *ph;
+     Elf32_Phdr		*p, *ph = NULL;
      int			size = sizeof(Elf32_Ehdr) - sizeof(Elf_Ident);
      unsigned long	loadaddr;
 
@@ -1447,7 +1447,7 @@  load_elf64(struct boot_file_t *file, loa
 {
      int			i;
      Elf64_Ehdr		*e = &(loadinfo->elf.elf64hdr);
-     Elf64_Phdr		*p, *ph;
+     Elf64_Phdr		*p, *ph = NULL;
      int			size = sizeof(Elf64_Ehdr) - sizeof(Elf_Ident);
      unsigned long	loadaddr;
 
Index: yaboot.git_head/include/setjmp.h
===================================================================
--- yaboot.git_head.orig/include/setjmp.h
+++ yaboot.git_head/include/setjmp.h
@@ -36,4 +36,4 @@  extern int __sigsetjmp (jmp_buf __env, i
 
 extern void longjmp (jmp_buf __env, int __val);
 
-#endif
\ No newline at end of file
+#endif
Index: yaboot.git_head/second/partition.c
===================================================================
--- yaboot.git_head.orig/second/partition.c
+++ yaboot.git_head/second/partition.c
@@ -61,7 +61,7 @@  static const char *valid_mac_partition_t
 
 
 #define MAX_BLOCK_SIZE	2048
-static unsigned char block_buffer[MAX_BLOCK_SIZE];
+static char block_buffer[MAX_BLOCK_SIZE];
 
 static void
 add_new_partition(struct partition_t**	list, int part_number, const char *part_type,
Index: yaboot.git_head/include/ext2fs/bitops.h
===================================================================
--- yaboot.git_head.orig/include/ext2fs/bitops.h
+++ yaboot.git_head/include/ext2fs/bitops.h
@@ -13,6 +13,7 @@ 
  * Linus Torvalds.
  */
 
+#include <string.h>
 
 extern int ext2fs_set_bit(int nr,void * addr);
 extern int ext2fs_clear_bit(int nr, void * addr);
@@ -412,7 +413,7 @@  _INLINE_ __u32 ext2fs_swab32(__u32 val)
 #if !defined(_EXT2_HAVE_ASM_FINDBIT_)
 _INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
 {
-	char	*cp = (unsigned char *) addr;
+	unsigned char	*cp = (unsigned char *) addr;
 	int 	res = 0, d0;
 
 	if (!size)
Index: yaboot.git_head/second/cfg.c
===================================================================
--- yaboot.git_head.orig/second/cfg.c
+++ yaboot.git_head/second/cfg.c
@@ -38,7 +38,7 @@  typedef enum {
 typedef struct {
      CONFIG_TYPE type;
      char *name;
-     void *data;
+     char *data;
 } CONFIG;
 
 #define MAX_TOKEN 200
Index: yaboot.git_head/second/fs_ext2.c
===================================================================
--- yaboot.git_head.orig/second/fs_ext2.c
+++ yaboot.git_head/second/fs_ext2.c
@@ -461,7 +461,7 @@  ext2_read(	struct boot_file_t*	file,
      read_last_logical = file->pos / bs;
      read_total = 0;
      read_max = size;
-     read_buffer = (unsigned char*)buffer;
+     read_buffer = (char*)buffer;
      read_result = 0;
 
      retval = ext2fs_block_iterate(fs, file->inode, 0, 0, read_iterator, 0);
Index: yaboot.git_head/second/fs_reiserfs.c
===================================================================
--- yaboot.git_head.orig/second/fs_reiserfs.c
+++ yaboot.git_head/second/fs_reiserfs.c
@@ -154,7 +154,7 @@  reiserfs_close( struct boot_file_t *file
 
 
 static __inline__ __u32
-log2( __u32 word )
+local_log2( __u32 word )
 {
      int i = 0;
      while( word && (word & (1 << ++i)) == 0 );
@@ -426,7 +426,7 @@  reiserfs_read_super( void )
 
      INFO->version = le16_to_cpu(super.s_version);
      INFO->blocksize = le16_to_cpu(super.s_blocksize);
-     INFO->blocksize_shift = log2( INFO->blocksize );
+     INFO->blocksize_shift = local_log2( INFO->blocksize );
 
      INFO->journal_block = le32_to_cpu(super.s_journal_block);
      INFO->journal_block_count = le32_to_cpu(super.s_orig_journal_size);
Index: yaboot.git_head/second/fs_xfs.c
===================================================================
--- yaboot.git_head.orig/second/fs_xfs.c
+++ yaboot.git_head/second/fs_xfs.c
@@ -522,7 +522,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);
 		}