build: quiet some "gcc -Wall" compiler warnings

Quiet a number of simple compiler warnings:
- pointers not initialized by ext2fs_get_mem()
- return without value in non-void function
- dereferencing type-punned pointers
- unused variables

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/e2fsck/message.c b/e2fsck/message.c
index 980dc4b..b79b895 100644
--- a/e2fsck/message.c
+++ b/e2fsck/message.c
@@ -197,7 +197,7 @@
 static void print_pathname(FILE *f, ext2_filsys fs, ext2_ino_t dir,
 			   ext2_ino_t ino)
 {
-	errcode_t	retval;
+	errcode_t	retval = 0;
 	char		*path;
 
 	if (!dir && (ino < num_special_inodes)) {
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index ab67cff..05ef626 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1824,7 +1824,7 @@
 		return 0;
 	}
 	if (!(ptr->flags & PR_CONFIG)) {
-		char	key[9], *new_desc;
+		char	key[9], *new_desc = NULL;
 
 		sprintf(key, "0x%06x", code);
 
diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c
index e94ef4e..fcacabb 100644
--- a/e2fsck/recovery.c
+++ b/e2fsck/recovery.c
@@ -408,14 +408,14 @@
 			if (tid_geq(next_commit_ID, info->end_transaction))
 				break;
 
-		jbd_debug(2, "Scanning for sequence ID %u at %lu/%lu\n",
+		jbd_debug(2, "Scanning for sequence ID %u at %llu/%lu\n",
 			  next_commit_ID, next_log_block, journal->j_last);
 
 		/* Skip over each chunk of the transaction looking
 		 * either the next descriptor block or the final commit
 		 * record. */
 
-		jbd_debug(3, "JBD: checking block %ld\n", next_log_block);
+		jbd_debug(3, "JBD: checking block %llu\n", next_log_block);
 		err = jread(&bh, journal, next_log_block);
 		if (err)
 			goto failed;
diff --git a/e2fsck/region.c b/e2fsck/region.c
index e9abb56..4b669f0 100644
--- a/e2fsck/region.c
+++ b/e2fsck/region.c
@@ -171,7 +171,7 @@
 
 int main(int argc, char **argv)
 {
-	region_t	r;
+	region_t	r = NULL;
 	int		pc = 0, ret;
 	region_addr_t	start, end;
 
diff --git a/e2fsck/sigcatcher.c b/e2fsck/sigcatcher.c
index 10b9328..faafb57 100644
--- a/e2fsck/sigcatcher.c
+++ b/e2fsck/sigcatcher.c
@@ -251,6 +251,7 @@
 	END_TABLE
 };
 
+#if 0 /* should this be hooked in somewhere? */
 static struct str_table sigstrap_code_table[] = {
 #ifdef TRAP_BRKPT
 	DEFINE_ENTRY(TRAP_BRKPT)
@@ -260,6 +261,7 @@
 #endif
 	END_TABLE
 };
+#endif
 
 static struct str_table sigcld_code_table[] = {
 #ifdef CLD_EXITED
@@ -283,6 +285,7 @@
 	END_TABLE
 };
 
+#if 0 /* should this be hooked in somewhere? */
 static struct str_table sigpoll_code_table[] = {
 #ifdef POLL_IN
 	DEFINE_ENTRY(POLL_IN)
@@ -304,6 +307,7 @@
 #endif
 	END_TABLE
 };
+#endif
 
 static const char *lookup_table(int num, struct str_table *table)
 {
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 6970b12..4a929b0 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -1163,7 +1163,8 @@
 			 struct blkid_magic *id __BLKID_ATTR((unused)),
 			 unsigned char *buf)
 {
-	struct hfs_mdb *hfs = (struct hfs_mdb *) buf;
+	struct hfs_mdb *hfs = (struct hfs_mdb *)buf;
+	unsigned long long *uuid_ptr;
 	char	uuid_str[17];
 	__u64	uuid;
 
@@ -1171,7 +1172,8 @@
 	    (memcmp(hfs->embed_sig, "HX", 2) == 0))
 		return 1;	/* Not hfs, but an embedded HFS+ */
 
-	uuid = blkid_le64(*((unsigned long long *) hfs->finder_info.id));
+	uuid_ptr = (unsigned long long *)hfs->finder_info.id;
+	uuid = blkid_le64(*uuid_ptr);
 	if (uuid) {
 		sprintf(uuid_str, "%016llX", uuid);
 		blkid_set_tag(probe->dev, "UUID", uuid_str, 0);
@@ -1205,9 +1207,10 @@
 	unsigned int leaf_node_size;
 	unsigned int leaf_block;
 	unsigned int label_len;
-	int ext;
+	unsigned long long *uuid_ptr;
 	__u64 leaf_off, uuid;
 	char	uuid_str[17], label[512];
+	int ext;
 
 	/* Check for a HFS+ volume embedded in a HFS volume */
 	if (memcmp(sbd->signature, "BD", 2) == 0) {
@@ -1235,7 +1238,8 @@
 	    (memcmp(hfsplus->signature, "HX", 2) != 0))
 		return 1;
 
-	uuid = blkid_le64(*((unsigned long long *) hfsplus->finder_info.id));
+	uuid_ptr = (unsigned long long *)hfsplus->finder_info.id;
+	uuid = blkid_le64(*uuid_ptr);
 	if (uuid) {
 		sprintf(uuid_str, "%016llX", uuid);
 		blkid_set_tag(probe->dev, "UUID", uuid_str, 0);
diff --git a/lib/ext2fs/crc32c.c b/lib/ext2fs/crc32c.c
index da2c60b..b54fc27 100644
--- a/lib/ext2fs/crc32c.c
+++ b/lib/ext2fs/crc32c.c
@@ -1117,12 +1117,12 @@
 		be = ext2fs_crc32c_be(t->crc, test_buf + t->start, t->length);
 		if (le != t->crc_le) {
 			printf("Test %d LE fails, %x != %x\n",
-			       (t - test), le, t->crc_le);
+			       (int) (t - test), le, t->crc_le);
 			failures++;
 		}
 		if (be != t->crc_be) {
 			printf("Test %d BE fails, %x != %x\n",
-			       (t - test), be, t->crc_be);
+			       (int) (t - test), be, t->crc_be);
 			failures++;
 		}
 		t++;
diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c
index ca1446b..4cb7ca1 100644
--- a/lib/ext2fs/dblist.c
+++ b/lib/ext2fs/dblist.c
@@ -61,7 +61,7 @@
 			     struct ext2_db_entry2 *list,
 			     ext2_dblist *ret_dblist)
 {
-	ext2_dblist	dblist;
+	ext2_dblist	dblist = NULL;
 	errcode_t	retval;
 	ext2_ino_t	num_dirs;
 	size_t		len;
diff --git a/lib/ext2fs/qcow2.c b/lib/ext2fs/qcow2.c
index b0a0278..8394270 100644
--- a/lib/ext2fs/qcow2.c
+++ b/lib/ext2fs/qcow2.c
@@ -155,7 +155,7 @@
 	errcode_t ret = 0;
 	unsigned int l1_index, l2_index;
 	ext2_off64_t offset;
-	blk64_t *l1_table, *l2_table;
+	blk64_t *l1_table, *l2_table = NULL;
 	void *copy_buf = NULL;
 	size_t size;
 
diff --git a/lib/ext2fs/tst_bitmaps.c b/lib/ext2fs/tst_bitmaps.c
index 2a76292..57bfd6c 100644
--- a/lib/ext2fs/tst_bitmaps.c
+++ b/lib/ext2fs/tst_bitmaps.c
@@ -193,8 +193,7 @@
 
 void setup_cmd(int argc, char **argv)
 {
-	errcode_t	retval;
-	int		i, c, err;
+	int		c, err;
 	unsigned int	blocks = 128;
 	unsigned int	inodes = 0;
 	unsigned int	type = EXT2FS_BMAP64_BITARRAY;
@@ -373,7 +372,7 @@
 {
 	unsigned int block, num;
 	int err;
-	int test_result, op_result;
+	int test_result;
 
 	if (check_fs_open(argv[0]))
 		return;
@@ -509,7 +508,7 @@
 {
 	unsigned int inode;
 	int err;
-	int test_result, op_result;
+	int test_result;
 
 	if (check_fs_open(argv[0]))
 		return;
diff --git a/lib/quota/mkquota.c b/lib/quota/mkquota.c
index 42af1f2..fd3fbb5 100644
--- a/lib/quota/mkquota.c
+++ b/lib/quota/mkquota.c
@@ -25,6 +25,7 @@
 #define UINT_TO_VOIDPTR(val)  ((void *)(intptr_t)(val))
 #define VOIDPTR_TO_UINT(ptr)  ((unsigned int)(intptr_t)(ptr))
 
+#if DEBUG_QUOTA
 static void print_inode(struct ext2_inode *inode)
 {
 	if (!inode)
@@ -44,6 +45,7 @@
 
 	return;
 }
+#endif
 
 /*
  * Returns 0 if not able to find the quota file, otherwise returns its
@@ -121,7 +123,7 @@
 	int		retval = 0, i;
 	dict_t		*dict;
 	ext2_filsys	fs;
-	struct quota_handle *h;
+	struct quota_handle *h = NULL;
 	int		fmt = QFMT_VFS_V1;
 
 	if (!qctx)
diff --git a/misc/filefrag.c b/misc/filefrag.c
index 3ec788f..56985a1 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -242,7 +242,7 @@
 	} while (last == 0);
 
 	*num_extents = tot_extents;
-out:
+
 	return 0;
 }