[PATCH] kill off redundant NULL checks before kfree() in fs/jbd/

From: Jesper Juhl
Date: Fri Mar 25 2005 - 16:28:57 EST



No need to check for NULL before calling kfree().

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

--- linux-2.6.12-rc1-mm3-orig/fs/jbd/commit.c 2005-03-25 15:28:59.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/jbd/commit.c 2005-03-25 21:38:48.000000000 +0100
@@ -261,10 +261,8 @@ void journal_commit_transaction(journal_
struct buffer_head *bh = jh2bh(jh);

jbd_lock_bh_state(bh);
- if (jh->b_committed_data) {
- kfree(jh->b_committed_data);
- jh->b_committed_data = NULL;
- }
+ kfree(jh->b_committed_data);
+ jh->b_committed_data = NULL;
jbd_unlock_bh_state(bh);
}
journal_refile_buffer(journal, jh);
--- linux-2.6.12-rc1-mm3-orig/fs/jbd/transaction.c 2005-03-25 15:28:59.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/jbd/transaction.c 2005-03-25 21:40:35.000000000 +0100
@@ -227,8 +227,7 @@ repeat_locked:
spin_unlock(&transaction->t_handle_lock);
spin_unlock(&journal->j_state_lock);
out:
- if (new_transaction)
- kfree(new_transaction);
+ kfree(new_transaction);
return ret;
}

@@ -722,8 +721,7 @@ done:
journal_cancel_revoke(handle, jh);

out:
- if (frozen_buffer)
- kfree(frozen_buffer);
+ kfree(frozen_buffer);

JBUFFER_TRACE(jh, "exit");
return error;
@@ -902,8 +900,7 @@ repeat:
jbd_unlock_bh_state(bh);
out:
journal_put_journal_head(jh);
- if (committed_data)
- kfree(committed_data);
+ kfree(committed_data);
return err;
}



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/