]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fs:ext4:fix: Code refactoring to suppress compiler warnings
authorŁukasz Majewski <l.majewski@samsung.com>
Wed, 5 Dec 2012 08:06:39 +0000 (08:06 +0000)
committerTom Rini <trini@ti.com>
Fri, 7 Dec 2012 15:47:53 +0000 (08:47 -0700)
Several fixes to suppress compiler's (eldk-5.[12].x  gcc 4.6)
warning  [-Wunused-but-set-variable]

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
fs/ext4/ext4_common.c
fs/ext4/ext4_journal.c
fs/ext4/ext4fs.c

index 323875fa9452e9863b8fa21376b519c28f1729da..f12b8056cc02abb788bf4d9d6b70cf1f3e0ee8f1 100644 (file)
@@ -378,7 +378,6 @@ void ext4fs_update_parent_dentry(char *filename, int *p_ino, int file_type)
        struct ext_filesystem *fs = get_fs();
        /* directory entry */
        struct ext2_dirent *dir;
-       char *ptr = NULL;
        char *temp_dir = NULL;
 
        zero_buffer = zalloc(fs->blksz);
@@ -415,7 +414,6 @@ restart:
        if (ext4fs_log_journal(root_first_block_buffer, first_block_no_of_root))
                goto fail;
        dir = (struct ext2_dirent *)root_first_block_buffer;
-       ptr = (char *)dir;
        totalbytes = 0;
        while (dir->direntlen > 0) {
                /*
@@ -483,14 +481,12 @@ restart:
                        break;
 
                dir = (struct ext2_dirent *)((char *)dir + templength);
-               ptr = (char *)dir;
        }
 
        /* make a pointer ready for creating next directory entry */
        templength = dir->direntlen;
        totalbytes = totalbytes + templength;
        dir = (struct ext2_dirent *)((char *)dir + templength);
-       ptr = (char *)dir;
 
        /* get the next available inode number */
        inodeno = ext4fs_get_new_inode_no();
@@ -1200,6 +1196,11 @@ static void alloc_double_indirect_block(struct ext2_inode *file_inode,
                status = ext4fs_devread(di_blockno_parent *
                                        fs->sect_perblk, 0,
                                        fs->blksz, (char *)di_parent_buffer);
+
+               if (!status) {
+                       printf("%s: Device read error!\n", __func__);
+                       goto fail;
+               }
                memset(di_parent_buffer, '\0', fs->blksz);
 
                /*
@@ -1227,6 +1228,11 @@ static void alloc_double_indirect_block(struct ext2_inode *file_inode,
                                                fs->sect_perblk, 0,
                                                fs->blksz,
                                                (char *)di_child_buff);
+
+                       if (!status) {
+                               printf("%s: Device read error!\n", __func__);
+                               goto fail;
+                       }
                        memset(di_child_buff, '\0', fs->blksz);
                        /* filling of actual datablocks for each child */
                        for (j = 0; j < (fs->blksz / sizeof(int)); j++) {
index 8a252d66c336d813d6d13ddaee0f2d56877d8cbf..9f017084f17e37c1949947f557861d4f7b2c02ec 100644 (file)
@@ -410,7 +410,7 @@ int ext4fs_check_journal_state(int recovery_flag)
        int transaction_state = TRANSACTION_COMPLETE;
        int prev_desc_logical_no = 0;
        int curr_desc_logical_no = 0;
-       int ofs, flags, block;
+       int ofs, flags;
        struct ext2_inode inode_journal;
        struct journal_superblock_t *jsb = NULL;
        struct journal_header_t *jdb = NULL;
@@ -453,7 +453,6 @@ int ext4fs_check_journal_state(int recovery_flag)
 
        i = be32_to_cpu(jsb->s_first);
        while (1) {
-               block = be32_to_cpu(jsb->s_first);
                blknr = read_allocated_block(&inode_journal, i);
                memset(temp_buff1, '\0', fs->blksz);
                ext4fs_devread(blknr * fs->sect_perblk,
index 80b3b90907d29b540c894b3c897519105a8747b5..64d8a6d9723a7eedb00bc918b6d6f258568c2f4d 100644 (file)
@@ -931,7 +931,6 @@ static int ext4fs_write_file(struct ext2_inode *file_inode,
        int previous_block_number = -1;
        int delayed_start = 0;
        int delayed_extent = 0;
-       int delayed_skipfirst = 0;
        int delayed_next = 0;
        char *delayed_buf = NULL;
 
@@ -964,7 +963,6 @@ static int ext4fs_write_file(struct ext2_inode *file_inode,
                                        previous_block_number = blknr;
                                        delayed_start = blknr;
                                        delayed_extent = blockend;
-                                       delayed_skipfirst = skipfirst;
                                        delayed_buf = buf;
                                        delayed_next = blknr +
                                            (blockend >> SECTOR_BITS);
@@ -973,7 +971,6 @@ static int ext4fs_write_file(struct ext2_inode *file_inode,
                                previous_block_number = blknr;
                                delayed_start = blknr;
                                delayed_extent = blockend;
-                               delayed_skipfirst = skipfirst;
                                delayed_buf = buf;
                                delayed_next = blknr +
                                    (blockend >> SECTOR_BITS);