]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fs: ext4: avoid NULL check before free()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 28 Apr 2020 19:50:02 +0000 (21:50 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 1 May 2020 15:34:01 +0000 (11:34 -0400)
free() checks if its argument is NULL. Don't duplicate this in the calling
code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
fs/ext4/ext4_journal.c

index f8524e5a99abb51dcb5400c2c666c3ec2a656b91..0ceb73d9c916201327f89dcc04bfc546ac4bc4dc 100644 (file)
@@ -107,22 +107,18 @@ void ext4fs_free_journal(void)
        for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) {
                if (dirty_block_ptr[i]->blknr == -1)
                        break;
-               if (dirty_block_ptr[i]->buf)
-                       free(dirty_block_ptr[i]->buf);
+               free(dirty_block_ptr[i]->buf);
        }
 
        for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) {
                if (journal_ptr[i]->blknr == -1)
                        break;
-               if (journal_ptr[i]->buf)
-                       free(journal_ptr[i]->buf);
+               free(journal_ptr[i]->buf);
        }
 
        for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) {
-               if (journal_ptr[i])
-                       free(journal_ptr[i]);
-               if (dirty_block_ptr[i])
-                       free(dirty_block_ptr[i]);
+               free(journal_ptr[i]);
+               free(dirty_block_ptr[i]);
        }
        gindex = 0;
        gd_index = 0;
@@ -272,8 +268,7 @@ void ext4fs_free_revoke_blks(void)
        struct revoke_blk_list *next_node = NULL;
 
        while (tmp_node != NULL) {
-               if (tmp_node->content)
-                       free(tmp_node->content);
+               free(tmp_node->content);
                tmp_node = tmp_node->next;
        }