fs: ext4: avoid NULL check before free()
PATCH 1/1 fs: ext4: avoid NULL check before free()
free() checks if its argument is NULL. Don't duplicate this in the calling code.
Signed-off-by Heinrich Schuchardt <[email protected]>
--- fs/ext4/ext4_journal.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
fs/ext4/ext4_journal.c +5 -10
@@ -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; }
--
2.26.2
PATCH 1/1 fs: ext4: avoid NULL check before free()
Quoted 4 lines · Heinrich Schuchardt
free()checks if its argument is NULL. Don't duplicate this in the calling code.Signed-off-by Heinrich Schuchardt <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200501/1874ec37/attachment.sig>